OpenFrameWorks & apache2 on Ubuntu


I created an app that gets data from the apache served through the functionality called piped logs. In windows it works fine (but videos in windows are not really smooth). I decided to compile my app in Ubuntu. It works just fine when I launch it from codeblocks or when I start it myself via gui or from command line, even if I lunch it as Root.

However: when Apache launches the application fails to create the window (some cout output located at main() before apprunner(…) is shown in the command line). I digged into the apache error logs and I found the following mistake:

[ error ] ofAppGLFWWindow: 65542: X11: Failed to open X display
[ error ] ofAppGLFWWindow: couldn’t init GLFW
[ error ] ofAppGLFWWindow: 65537: The GLFW library is not initialized
[ error ] ofFbo: GL frame buffer object not supported by this graphics card
Segmentation fault (core dumped)

This is beyond my tech skills. I found something about compiler flags. My hunch is that the context where apache runs does not have the graphical facilities to run apps with OpenGL. But those are just conjectures. Any help is greatly appreciated.

try setting the environment variable:


if you are using some kind of bash script you can set it using

export DISPLAY=:0

if that doesn’t work try changing the user that apache uses to run to your user

Thank you. Unfortunately that didn’t work.

But I came across something else. I made a copy of the executable file of my project in another folder. And I got the same error message. Even after copying the “bin” and the “libs” folders of my own project (not the ones from OF) I got the same error.

I know that apache spawns the processes somewhere else ( I think in: APACHE_RUN_DIR=/var/run/apache2$SUFFIX )

So now my question is: is my OF application dependent on the OF folder structure? i.e. should I copy the entire openframeworks folder to the place where apache is spawning my application?

no, you just need the bin folder with the data… also in linux the application sets the data directory to the one where the executable is contained so even if it’s run from somewhere else it should be able to find the data folder