Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

So the workaround I found was to add


BEFORE rosbuild_init() in my CMakeLists.txt

I found this out by first looking at my gcc line:

/usr/bin/c++   -O2 -g     -pthread CMakeFiles/main.dir/src/main.cpp.o  -o ../bin/main -rdynamic -L/home/kir1pal/svslocal/lib -L/opt/ros/groovy/lib -lroscpp -l:/usr/lib/ -l:/usr/lib/ -lrosconsole -l:/usr/lib/ -l:/usr/lib/ -lxmlrpcpp -lroscpp_serialization -lrostime -l:/usr/lib/ -l:/usr/lib/ -l:/usr/lib/ -lpthread -lcpp_common /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ /home/kir1pal/svslocal/lib/ -Wl,-rpath,/opt/ros/groovy/lib

At the end is -rpath,/opt/ros/groovy/lib, which seems to be set by cmake macro LINK_DIRECTORIES. This seemed the be the cause of the problem. /opt/ros/groovy/lib is added to LINK_DIRECTORIES by rosbuild_init() and therefore by calling LINK_DIRECTORIES before rosbuild_init() puts my library path in front of it.

This is not an ideal solution. If anyone has a better idea I would like to hear it