codegen
codegen

Reputation: 118

rpath ignored after multiple libraries

I'm working on integrating robot operating system (ROS2) into a plugin for a larger program that erases the LD_LIBRARY_PATH before the plugin is called. I'm doing some preliminary tests to try using the rpath to specify the location of the ROS libraries.

This is a simple standalone executable (not the plugin) to try some options. In the makefile I'm specifying the location to the ROS libraries using the "-Wl,-rpath=/opt/ros/foxy/lib/", and running the program without the LD_LIBRARY_PATH set. However this fails, and when I check with "LD_DEBUG=libs ldd program", it shows the first several libraries are found using the RUNPATH, but part way thru, after finding libpthread.so.0 on the system path, it stops searching the RUNPATH, and only searches the system path. I did specify all of the C++ libraries at the end of the link command, so the dynamic linker is using its own order for loading the libraries.

I first tested the build using LD_LIBRARY_PATH (and no -rpath option). Any ideas on why the dynamic linker would stop using directory given by -rpath?

I guess my other option is to dynamically add the LD_LIBRARY_PATH to the environment.

Thanks for any info.

Upvotes: 1

Views: 103

Answers (0)

Related Questions