Simulator on MacOS


I try to create a Makefile for the Pokitto Simulator on MacOS. Ultimately I do this to be able to compile

Now I am stuck: I am missing a definition of function lcdRectangle()
it is declared in POKITTO_SIM/SimLCD.h and invoked in POKITTO_CORE/PokittoDisplay.cpp:

…/POKITTO_CORE/PokittoDisplay.cpp:205: lcdRectangle(x,y,x2,y2,color);
…/POKITTO_SIM/SimLCD.h:61:extern void lcdRectangle(int16_t,int16_t,int16_t,int16_t,uint16_t);

Am I missing something?
– Olav

Hi Olav

I think this is a helper function added by one of our collaborators, that may not have been added for the simulator.

I will check.

EDIT: I’m off until the afternoon so it will be in the evening, sorry.


I had a look. Make sure SimLCD.cpp is included in your project.

It’s there, on line 103

void Pokitto::lcdRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t c) {

Also Olav,

make sure you have POK_SIM defined when you target the simulator

Jonne, thank you so much for your help.

The problem seems to be that I started from repo which does not have the file SimLCD.cpp .

Maybe it would be a good idea to mark the PokittoSim repo as deprecated and point people to the newer PokittoLib ?

I will switch to and see how it goes from there.

– Olav

1 Like

A quick update:

I managed to compile the example HelloWorld into an executable. Sadly, this crashes immediately:

~/w/P/E/HelloWorld> ./HelloWorld
2018-08-22 11:16:16.681 HelloWorld[78380:13928132] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘nextEventMatchingMask should only be called from the Main Thread!’
*** First throw call stack:
0 CoreFoundation 0x00007fff55d3e2db __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff7cedfc76 objc_exception_throw + 48
2 AppKit 0x00007fff539ea297 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4167
3 libSDL2-2.0.0.dylib 0x00000001018f640c Cocoa_PumpEvents + 211
4 libSDL2-2.0.0.dylib 0x0000000101893ca5 SDL_PumpEvents_REAL + 23
5 libSDL2-2.0.0.dylib 0x0000000101893d20 SDL_WaitEventTimeout_REAL + 76
6 HelloWorld 0x0000000101812bfd _ZN7Pokitto9Simulator11pollButtonsEv + 29
7 HelloWorld 0x0000000101813e06 _ZN7Pokitto9Simulator14refreshDisplayEv + 38
8 HelloWorld 0x0000000101813dc2 _Z14rfrsh_callbackjPv + 34
9 libSDL2-2.0.0.dylib 0x00000001018bfba1 SDL_TimerThread + 160
10 libSDL2-2.0.0.dylib 0x00000001018bf6f0 SDL_RunThread + 60
11 libSDL2-2.0.0.dylib 0x00000001018feb9b RunThread + 9
12 libsystem_pthread.dylib 0x00007fff7de11661 _pthread_body + 340
13 libsystem_pthread.dylib 0x00007fff7de1150d _pthread_body + 0
14 libsystem_pthread.dylib 0x00007fff7de10bf9 thread_start + 13
libc++abi.dylib: terminating with uncaught exception of type NSException
fish: ‘./HelloWorld’ terminated by signal SIGABRT (Abort)

Maybe my libSDL2 has problems. I will investigate later.
– Olav

Found several issues on different GitHub projects with the same issue.
Almost certainly SDL2 at fault.

Which version of SDL2 are you using?