SDL linking library
Having a little trouble linking SDL to an executable in ROS. Here is what I have in my CMakelist to link the library.
rosbuild_add_executable(testbla src/testing.cpp) target_link_libraries(testbla SDL)
This is resulting in an error at runtime, seg faulting. The cause has been traced back to the initialization.
SDLInit(SDLINIT_VIDEO);
The debugging reveals..
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff16c6468 in dlerror () from /lib/libdl.so.2 (gdb) bt0 0x00007ffff16c6468 in dlerror () from /lib/libdl.so.2
1 0x00007ffff264b9b7 in SDL_LoadFunction () from /usr/lib/libSDL-1.2.so.0
2 0x00007ffff264cc15 in ?? () from /usr/lib/libSDL-1.2.so.0
3 0x00007ffff264d7c8 in ?? () from /usr/lib/libSDL-1.2.so.0
4 0x00007ffff2654f36 in ?? () from /usr/lib/libSDL-1.2.so.0
5 0x00007ffff2647cec in SDL_VideoInit () from /usr/lib/libSDL-1.2.so.0
6 0x00007ffff261e7eb in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
7 0x00007ffff261e82f in SDL_Init () from /usr/lib/libSDL-1.2.so.0
8 0x0000000000401bb4 in main (argc=
, argv=0x0) at /home/mak1pal/ros/constrained_teleop/src/testing.cpp:53
(gdb) quit A debugging session is active.
Any help is appreciated. Thanks.
Asked by kmaroney on 2011-07-19 15:02:25 UTC
Comments
Maybe check the output of ldd to see which libraries are used at runtime.
Asked by LiMuBei on 2011-11-28 23:55:36 UTC
Maybe two conflicting versions of a library are linked. This can happen if a ROS package you depend on has a statically linked version (e.g. using copied source files) and SDL links against the dynamic system library, or vice versa. Does the crash still occur if you have no depends in your manifest?
Asked by roehling on 2011-09-15 02:27:49 UTC
Hi Tully, we did compile and link the same code outside of ROS and it worked perfectly. The non ROS code is available here: http://ias.cs.tum.edu/~pangerci/testing.cpp. We used the following command to compile and link: "g++ -o sdl testing.cpp -I/usr/include/SDL/ -L/usr/lib/ -lSDL"
Asked by dejanpan on 2011-07-20 11:26:50 UTC
Can you do this with a non ROS executable? I think this might be more of a SDL problem than a ROS problem.
Asked by tfoote on 2011-07-19 17:11:56 UTC