SDL2 on Raspberry Pi

vanfanel wrote:> Even if some SDL2.0 games are now building and working fine on my RaspberryPi, some are giving me linking errors. For example, Commander Genius (https://github.com/gerstrong/Commander-Genius.git) compiles without problems, but it has undefined references in the SDL2.0 libraries upon linking:

Code:

[100%] [100%] Building CXX object CMakeFiles/CommanderGenius.dir/src/ConfigHandler.cpp.o
Building CXX object CMakeFiles/CommanderGenius.dir/src/misc.cpp.o
Linking CXX executable …/Build/LINUX/CommanderGenius
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_resource_delete' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_element_change_attributes' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_write_data’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_display_open' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit_sync’
/usr/local/lib/libSDL2.so: undefined reference to bcm_host_init' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_create’
/usr/local/lib/libSDL2.so: undefined reference to graphics_get_display_size' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_start’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_element_remove' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_rect_set’
/usr/local/lib/libSDL2.so: undefined reference to `vc_dispmanx_element_add’
collect2: ld returned 1 exit status
distcc[1403] ERROR: compile (null) on localhost failed
make[2]: *** […/Build/LINUX/CommanderGenius] Error 1
make[1]: *** [CMakeFiles/CommanderGenius.dir/all] Error 2
make: *** [all] Error 2

I tried the binary SDL2.0 too, and I get the same error, so it’s not my SDL2.0 build. Maybe libSDL2.0 is looking for Video Core support libs in the wrong location? On latest Raspbian, these are in /opt/vc/libs, with corresponding includes in /opt/vc/include.
Any hint on how to fix these linking problems?

vanfanel wrote:> Even if some SDL2.0 games are now building and working fine on my RaspberryPi, some are giving me linking errors. For example, Commander Genius (https://github.com/gerstrong/Commander-Genius.git) compiles without problems, but it has undefined references in the SDL2.0 libraries upon linking:

Code:

[100%] [100%] Building CXX object CMakeFiles/CommanderGenius.dir/src/ConfigHandler.cpp.o
Building CXX object CMakeFiles/CommanderGenius.dir/src/misc.cpp.o
Linking CXX executable …/Build/LINUX/CommanderGenius
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_resource_delete' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_element_change_attributes' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_write_data’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_display_open' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit_sync’
/usr/local/lib/libSDL2.so: undefined reference to bcm_host_init' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_create’
/usr/local/lib/libSDL2.so: undefined reference to graphics_get_display_size' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_start’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_element_remove' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_rect_set’
/usr/local/lib/libSDL2.so: undefined reference to `vc_dispmanx_element_add’
collect2: ld returned 1 exit status
distcc[1403] ERROR: compile (null) on localhost failed
make[2]: *** […/Build/LINUX/CommanderGenius] Error 1
make[1]: *** [CMakeFiles/CommanderGenius.dir/all] Error 2
make: *** [all] Error 2

I tried the binary SDL2.0 too, and I get the same error, so it’s not my SDL2.0 build. Maybe libSDL2.0 is looking for Video Core support libs in the wrong location? On latest Raspbian, these are in /opt/vc/libs, with corresponding includes in /opt/vc/include.
Any hint on how to fix these linking problems?

2013/10/10 vanfanel

**
Even if some SDL2.0 games are now building and working fine on my
RaspberryPi, some are giving me linking errors. For example, Commander
Genius (

Code:

https://github.com/gerstrong/Commander-Genius.git

) compiles without problems, but it has undefined references in the SDL2.0
libraries upon linking:

Code:

[100%] [100%] Building CXX object
CMakeFiles/CommanderGenius.dir/src/ConfigHandler.cpp.o
Building CXX object CMakeFiles/CommanderGenius.dir/src/misc.cpp.o
Linking CXX executable …/Build/LINUX/CommanderGenius
/usr/local/lib/libSDL2.so: undefined reference to
vc_dispmanx_resource_delete' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit’
/usr/local/lib/libSDL2.so: undefined reference to
vc_dispmanx_element_change_attributes' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_write_data’
/usr/local/lib/libSDL2.so: undefined reference to
vc_dispmanx_display_open' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit_sync’
/usr/local/lib/libSDL2.so: undefined reference to bcm_host_init' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_create’
/usr/local/lib/libSDL2.so: undefined reference to
graphics_get_display_size' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_start’
/usr/local/lib/libSDL2.so: undefined reference to
vc_dispmanx_element_remove' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_rect_set’
/usr/local/lib/libSDL2.so: undefined reference to `vc_dispmanx_element_add’
collect2: ld returned 1 exit status
distcc[1403] ERROR: compile (null) on localhost failed
make[2]: *** […/Build/LINUX/CommanderGenius] Error 1
make[1]: *** [CMakeFiles/CommanderGenius.dir/all] Error 2
make: *** [all] Error 2

I tried the binary SDL2.0 too, and I get the same error, so it’s not my
SDL2.0 build. Maybe libSDL2.0 is looking for Video Core support libs in the
wrong location? On latest Raspbian, these are in /opt/vc/libs, with
corresponding includes in /opt/vc/include.
Any hint on how to fix these linking problems?

Not sure how the build process works for this game, make sure that it’s
using the output of sdl2-config --libs to set up the linker properly (also
verify that sdl2-config --libs includes -L/opt/vc/lib -lbcm_host)–
Gabriel.

Even if some SDL2.0 games are now building and working fine on my RaspberryPi, some are giving me linking errors. For example, Commander Genius (https://github.com/gerstrong/Commander-Genius.git) compiles without problems, but it has undefined references in the SDL2.0 libraries upon linking:

Code:

[100%] [100%] Building CXX object CMakeFiles/CommanderGenius.dir/src/ConfigHandler.cpp.o
Building CXX object CMakeFiles/CommanderGenius.dir/src/misc.cpp.o
Linking CXX executable …/Build/LINUX/CommanderGenius
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_resource_delete' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_element_change_attributes' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_write_data’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_display_open' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_submit_sync’
/usr/local/lib/libSDL2.so: undefined reference to bcm_host_init' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_resource_create’
/usr/local/lib/libSDL2.so: undefined reference to graphics_get_display_size' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_update_start’
/usr/local/lib/libSDL2.so: undefined reference to vc_dispmanx_element_remove' /usr/local/lib/libSDL2.so: undefined reference tovc_dispmanx_rect_set’
/usr/local/lib/libSDL2.so: undefined reference to `vc_dispmanx_element_add’
collect2: ld returned 1 exit status
distcc[1403] ERROR: compile (null) on localhost failed
make[2]: *** […/Build/LINUX/CommanderGenius] Error 1
make[1]: *** [CMakeFiles/CommanderGenius.dir/all] Error 2
make: *** [all] Error 2

I tried the binary SDL2.0 too, and I get the same error, so it’s not my SDL2.0 build. Maybe libSDL2.0 is looking for Video Core support libs in the wrong location? On latest Raspbian, these are in /opt/vc/libs, with corresponding includes in /opt/vc/include.
Any hint on how to fix these linking problems?

I got to compile and link the game after configuring the linker, as you told me. (It has some problems the author seems to be fixing, but it will eventually work).
I’ve also updated to the latest mercurial libSDL2.

However, I’m trying to compile it with GLES support, and I’ve come to another problem:
I uninstalled OpenGL packages (MESA stuff) on my Pi, since it was causing trouble with many other apps detecting GL/gl.h, wich is useless on the Pi, but even if I configure libSDL2 with:

Code:

./configure --disable-video-x11 --disable-video-opengl

…I still get “/usr/local/include/SDL2/SDL_opengl.h” installed on my system, wich in turn includes “GL/gl.h”, wich is plain wrong.

I got to compile and link the game after configuring the linker, as you told me. (It has some problems the author seems to be fixing, but it will eventually work).
I’ve also updated to the latest mercurial libSDL2.

However, I’m trying to compile it with GLES support, and I’ve come to another problem:
I uninstalled OpenGL packages (MESA stuff) on my Pi, since it was causing trouble with many other apps detecting GL/gl.h, wich is useless on the Pi, but even if I configure libSDL2 with:

Code:

./configure --disable-video-x11 --disable-video-opengl

…I still get “/usr/local/include/SDL2/SDL_opengl.h” installed on my system, wich in turn includes “GL/gl.h”, wich is plain wrong, as some apps will try to include it.
Maybe it’s not SDL2’s fault but the apps fault, since they assume desktop GL instead of GLES, so SDL2_opengl.h must be present anyway, even if there’s no GL/gl.h in the system?