eglGetDisplay fails randomly

PowerVR SDK 3.4, OSX 10.10, XCode 6

I’m porting a rendering engine with PVR for OpenGL ES as Mac App. However I find this may crash randomly

display_ = eglGetDisplay((EGLNativeDisplayType)0);

I’ve followed the code in examples to create NSWindow/NSView

After digging into the forum, I found .

My problem is I need to dlopen(‘libGLESv2.dylib’) before dlopen(‘libEGL.dylib’) This solves partly though


This solves partly though

If you can explain the issues you are still encountering, we can investigate the cause.


After some digging, XCode’s Instruments showed that this file will be opened during initializaing:

Caller Function Executable FD (return) Path FD (arg0) FD (arg1)

1246 0x10cd7256b open_nocancel Text_clang60_d 17 /Users/anthony/.pvrconfig/Imagination Technologies/com.powervr.PVRVFrame.plist

However, sometimes my app cannot open this file successfully, which makes the app crash as the screen shot.

PS. I’m loading PVRFrame with dlopen/dlsym, but I think it should be the same as the examples provided

The com.powervr.PVRVFrame.plist configuration file is read by the emulation libraries to determine if a device profile should be used (e.g. Amazon Kindle Fire HD) or if the emulator should just use the full capabilities of the host OpenGL driver.

However, sometimes my app cannot open this file successfully, which makes the app crash as the screen shot.

I'm not sure why you're having this problem. We've been able to reproduce the problem, but only when a debug session is restarted. Stopping and starting manually doesn't seem to cause the problem. It may be an Xcode bug.

FYI, I've filed a feature request against PVRVFrame (BRN53245) for an .app bundle's Resource directory to be used as the primary *.plist search location. The ~/.pvrconfig/ directory will be used as a fall back. This feature will enable developers to easily carry custom *.plist configurations in their .app bundles.


I build a command line tool with the emulation library. It seems that the problem will happen more frequently if this tool runs again and again for batch processing:

cd /Users/anthony/SDK/klayge/KlayGE/bin/darwin_x64 && ./FXMLJIT ios /Users/anthony/SDK/klayge/KlayGE/media/RenderFX/ToneMapping.fxml /Users/anthony/SDK/klayge/KlayGE/Samples/build/clang60_ios_i386/Text/Resources


WARNING: No declaration found at the start. The declaration will be recreated.

/bin/sh: line 1: 44222 Segmentation fault: 11 ./FXMLJIT ios /Users/anthony/SDK/klayge/KlayGE/media/RenderFX/ToneMapping.fxml /Users/anthony/SDK/klayge/KlayGE/Samples/build/clang60_ios_i386/Text/Resources

It is quite strange, and maybe it’s related with system file descriptors.

Thanks for you help, and I’ll reply here if I get more details.