Closed fnoop closed 7 years ago
Adding -DCMAKE_INSTALL_RPATH=/srv/maverick/software/librealsense/lib:/srv/maverick/software/collision_avoidance/lib
to cmake line makes it work for me, but this should be set automatically I think.
I think that the behavior of either CMAKE_PREFIX_PATH and CMAKE_INSTALL_PREFIX are working as expected.
Cmake will only use rpath after installation when explicit told to do it (like when you set CMAKE_INSTALL_RPATH) because it doesn't always make sense to use it. Imagine that I have my drone dependencies on my host machine in a custom path and I'm compiling against it and, after installing on the drone, those will be on totally different places (probably on the default path on the drone), so the paths may not even exist on the final target.
Also, to have those path's hardcoded on the binary isn't very robust, so usually is preferred that you tell ld.so to look on extra paths before running (with LD_LIBRARY_PATH) if you know that you have objects installed on non-default paths instead of recording those paths on the binary.
LD_LIBRARY_PATH is generally frowned upon - setting library paths in ldconfig is OK so in the case of librealsense that would make sense. However, the coav-tool should surely be able to find it's own library without extra help?
libcoav is just like any other dependency from the POV of coav-control once is installed. ld.so should be able to find just like any other library.
If I compile like this:
/usr/bin/cmake .. -DCMAKE_PREFIX_PATH=/srv/maverick/software/librealsense -DCMAKE_INSTALL_PREFIX=/srv/maverick/software/collision_avoidance -DWITH_REALSENSE=ON -DWITH_TOOLS=ON -DWITH_SAMPLES=ON && make && make install
Then the compile and install goes fine. The relevent libraries are found and linked in correctly at the build stage:However, when installed the rpaths are not set so there are missing libraries: