Issue compiling OF example on RPI (linking error)

Hello there !

I am experiencing difficulties while trying to compile any OF example on the Raspberry PI.
It looks like a linking error (some dependencies may be missing).

  
  
  
[...]  
  
Linking bin/textureExample for linuxarmv6l  
g++ -o bin/textureExample obj/linuxarmv6l/Release/src/main.o obj/linuxarmv6l/Release/src/testApp.o  ../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a   -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -L/opt/vc/lib ../../../libs/kiss/lib/linuxarmv6l/libkiss.a ../../../libs/rtAudio/lib/linuxarmv6l/libRtAudio.a ../../../libs/tess2/lib/linuxarmv6l/libtess2.a ../../../libs/poco/lib/linuxarmv6l/libPocoNet.a ../../../libs/poco/lib/linuxarmv6l/libPocoData.a ../../../libs/poco/lib/linuxarmv6l/libPocoNetSSL.a ../../../libs/poco/lib/linuxarmv6l/libPocoCrypto.a ../../../libs/poco/lib/linuxarmv6l/libPocoZip.a ../../../libs/poco/lib/linuxarmv6l/libPocoUtil.a ../../../libs/poco/lib/linuxarmv6l/libPocoXML.a ../../../libs/poco/lib/linuxarmv6l/libPocoFoundation.a  ../../../libs/poco/lib/linuxarmv6l/libPocoNetSSL.a ../../../libs/poco/lib/linuxarmv6l/libPocoNet.a ../../../libs/poco/lib/linuxarmv6l/libPocoCrypto.a ../../../libs/poco/lib/linuxarmv6l/libPocoUtil.a ../../../libs/poco/lib/linuxarmv6l/libPocoXML.a ../../../libs/poco/lib/linuxarmv6l/libPocoFoundation.a  -pthread -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -lgmodule-2.0 -lgthread-2.0 -lrt -ludev -lsndfile -lopenal -lportaudio -lm -lpthread -lssl -lcrypto -lpulse-simple -lpulse -lasound -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0   -lfreeimage -lGLESv2 -lGLESv1_CM -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm   
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::getScreenSize(): error: undefined reference to 'XWidthOfScreen'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::getScreenSize(): error: undefined reference to 'XHeightOfScreen'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::destroyWindow(): error: undefined reference to 'XDestroyWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::destroyWindow(): error: undefined reference to 'XFree'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XOpenDisplay'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XDefaultScreen'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XDefaultScreenOfDisplay'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XMatchVisualInfo'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XCreateColormap'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XCreateWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XMapWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XFlush'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::handleX11Event(_XEvent const&): error: undefined reference to 'XkbGetMap'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::handleX11Event(_XEvent const&): error: undefined reference to 'XkbFreeClientMap'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::setWindowRect(ofRectangle const&): error: undefined reference to 'XMoveResizeWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::setWindowPosition(int, int): error: undefined reference to 'XMoveWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::setWindowShape(int, int): error: undefined reference to 'XResizeWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::checkEvents(): error: undefined reference to 'XCheckWindowEvent'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::checkEvents(): error: undefined reference to 'XCheckTypedEvent'  
collect2: ld returned 1 exit status  
make[1]: *** [bin/textureExample] Error 1  
make: *** [Release] Error 2  
  
  

I am using gcc 4.6.3 on a Linux raspberrypi 3.6.11+ (debian wheezy).
I had no problems compiling the OF library.

Do you have any ideas ?

Thank you,

Good Bye

are you using the release from http://www.openframeworks.cc/setup/raspberrypi/ or github?

I am using the release from http://www.openframeworks.cc/setup/raspberrypi/

are you running X11? I thought the RPi would run apps non-windowed inside of it but maybe try it with it disabled

I guess I am not.
I use SSH to control the RPi and I have enabled the boot to console via raspi-config.
I have just tried this way and it is still not working. (Edit : I have just found out that I had enabled X forwarding through SSH, I am going to try with X forwarding disabled) (2nd Edit : X forwarding disabled, it still doesn’t work)

However I don’t know how to make sure I am not running X11.

yeah - your setup sounds right

just realized there was a previous error with ofVbo (error: undefined reference to ‘dlsym’)

are you able to compile any other examples (like emptyExample)?

With emptyexample I get the same error :

  
  
  
Linking bin/emptyExample for linuxarmv6l  
g++ -o bin/emptyExample obj/linuxarmv6l/Release/src/main.o obj/linuxarmv6l/Release/src/testApp.o  ../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a   -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -L/opt/vc/lib ../../../libs/kiss/lib/linuxarmv6l/libkiss.a ../../../libs/rtAudio/lib/linuxarmv6l/libRtAudio.a ../../../libs/tess2/lib/linuxarmv6l/libtess2.a ../../../libs/poco/lib/linuxarmv6l/libPocoNet.a ../../../libs/poco/lib/linuxarmv6l/libPocoData.a ../../../libs/poco/lib/linuxarmv6l/libPocoNetSSL.a ../../../libs/poco/lib/linuxarmv6l/libPocoCrypto.a ../../../libs/poco/lib/linuxarmv6l/libPocoZip.a ../../../libs/poco/lib/linuxarmv6l/libPocoUtil.a ../../../libs/poco/lib/linuxarmv6l/libPocoXML.a ../../../libs/poco/lib/linuxarmv6l/libPocoFoundation.a  ../../../libs/poco/lib/linuxarmv6l/libPocoNetSSL.a ../../../libs/poco/lib/linuxarmv6l/libPocoNet.a ../../../libs/poco/lib/linuxarmv6l/libPocoCrypto.a ../../../libs/poco/lib/linuxarmv6l/libPocoUtil.a ../../../libs/poco/lib/linuxarmv6l/libPocoXML.a ../../../libs/poco/lib/linuxarmv6l/libPocoFoundation.a  -pthread -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -lgmodule-2.0 -lgthread-2.0 -lrt -ludev -lsndfile -lopenal -lportaudio -lm -lpthread -lssl -lcrypto -lpulse-simple -lpulse -lasound -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0   -lfreeimage -lGLESv2 -lGLESv1_CM -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm   
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofVbo.o):ofVbo.cpp:function ofVbo::setVertexData(float const*, int, int, int, int): error: undefined reference to 'dlsym'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::getScreenSize(): error: undefined reference to 'XWidthOfScreen'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::getScreenSize(): error: undefined reference to 'XHeightOfScreen'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::destroyWindow(): error: undefined reference to 'XDestroyWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::destroyWindow(): error: undefined reference to 'XFree'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XOpenDisplay'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XDefaultScreen'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XDefaultScreenOfDisplay'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XMatchVisualInfo'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XCreateColormap'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XCreateWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XMapWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::createX11NativeWindow(ofRectangle const&): error: undefined reference to 'XFlush'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::handleX11Event(_XEvent const&): error: undefined reference to 'XkbGetMap'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::handleX11Event(_XEvent const&): error: undefined reference to 'XkbFreeClientMap'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::setWindowRect(ofRectangle const&): error: undefined reference to 'XMoveResizeWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::setWindowPosition(int, int): error: undefined reference to 'XMoveWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::setWindowShape(int, int): error: undefined reference to 'XResizeWindow'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::checkEvents(): error: undefined reference to 'XCheckWindowEvent'  
../../../libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a(ofAppEGLWindow.o):ofAppEGLWindow.cpp:function ofAppEGLWindow::checkEvents(): error: undefined reference to 'XCheckTypedEvent'  
collect2: ld returned 1 exit status  
make[1]: *** [bin/emptyExample] Error 1  
make: *** [Release] Error 2  
  
  

In fact, I have never successfully compiled any of the examples I have tried and I always get this error.

Do you know what version of Raspbian you are using? The zip file usually contains the date (e.g. 2013-09-25-wheezy-raspbian.zip)

Considering that I ran rpi-update in the past days, I guess I am using the latest version of Raspbian.

I wonder if something was updated that would make OF have to be re-compiled

try

make clean -C …/…/…/libs/openFrameworksCompiled/project

and then try to compile the project again (it will re-compile OF as well and will take a while if you are not using a cross-compiler/distcc)

It re-compiled OF successfully but when it comes to compiling examples (even the emptyExample), I am still blocked by the same errors (ofVbo undefined reference to dlsym and ofAppEGLWindow.cpp undefined reference to X…)

i think for some reason the ifdefs in ofConstants are not detecting properly that it’s compiling in an rpi, probably something has changed in the latest updates and the test is different now?

Just a little update to tell that it has been “fixed” by burning an older distribution of wheezy raspbian which is known to work.

The problem must be linked to some updates I had made.