Intermittent error during "make run"

Hello friends! I am trying to run a basic app I wrote based on the oF tutorials but, periodically when doing make run, i get this error:

pi@raspberrypi ~/openFrameworks/apps/myApps/keyboardInteraction $ make run
tvservice-client: Failed to connect to TV service: -1
[ error ] ofAppEGLWindow: getScreenSize(): tried to get display size but failed
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): screenRect: 0x0
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): windowRect: 0x0
[ error ] ofAppEGLWindow: setupRPiNativeWindow(): dispman_element == DISPMANX_NO_HANDLE
[warning] ofAppEGLWindow: getNativeDisplay(): window not initialized, returning NULL
[warning] ofAppEGLWindow: getNativeDisplay(): window not initialized, returning NULL
[notice ] ofAppEGLWindow: createSurface(): setting up EGL Display
[notice ] ofAppEGLWindow: createSurface(): EGL Display correctly set
[notice ] ofAppEGLWindow: createSurface(): current renderer type: GL
[notice ] ofAppEGLWindow: createSurface(): default renderer detected
[ error ] ofAppEGLWindow: createSurface(): error creating surface: EGL_BAD_NATIVE_WINDOW invalid NativeWindow
[ error ] ofAppEGLWindow: createSurface(): verify that provided EGLNativeWindow is valid
[ error ] ofAppEGLWindow: setupOpenGL(): screen creation failed, window not inited
terminate called after throwing an instance of 'std::logic_error'
  what(): basic_string::_S_construct null not valid
make: * [run] Error 134

I don’t know why it shows up because it normally works but then this randomly shows up. I am not changing any configuration for my Pi. I am SSHing to the Pi through my laptop and using a TV via HDMI to view my apps. I would really appreciate any help!

Strange. This is probably the same issue:

Basically, the ofAppEGLWindow isn’t getting an EGL Context from the RPi display manager. According to the post above, this can happen when bcmhost_init() is called more than once. In ofAppEGLWindow we only call bcmhost_init() once here:

So, I’m wondering if you might be trying to initialize two windows somehow? What does your main.cpp file look like? I’m wondering if you mixed a few examples somehow? All speculation of course – I could have certainly made a mistake in ofAppEGLWindow :wink:

Is the RPi set to boot into X11?

1 Like

The RPi does boot into GUI. Should I disable that? And my main.cpp is:

#include "ofMain.h"
#include "testApp.h"
int main( ){
        ofSetupOpenGL(1024,768, OF_WINDOW);        
        ofRunApp( new testApp()); }

It’s the same one from the emptyExample since that is what the tutorials are currently based off of.

yeah - I would disable it and see if you get the same results. X11 will also take up some of your memory allocation to the GPU as well.

1 Like

For posterity, I ran into this problem and it turned out to be the memory split setting.

$ raspi-config
> Advanced Options
>Memory Split
Set to something like 64 or 128 (or higher if you app is mainly GPU bound)