On Wed, 2007-05-02 at 15:19 -0700, g-h-d wrote: > Your suggestion was correct: Thank you! > > g++ -o"testing_hal" ./main.o -Wl,-rpath,/usr/local/lib -lhal_base > > from what i read -L takes precedence over LD_LIBRARY_PATH (which i could not > get to work). how could i go about fixing the problem so i don't need > -rpath?
First, as has been pointed out this is not a GNU make issue; this is an issue with your compiler suite. However, you're confusing link-time with run-time. The -L argument to the linker tells it where to find libraries at link time, but has no impact on runtime at all. LD_LIBRARY_PATH and -rpath both change the runtime linker search path, but have no effect on link-time search paths. -rpath is used at link time, but affects only runtime, by adding a new search path to the resulting program that the runtime linker will use. LD_LIBRARY_PATH is set by the user before he/she invokes the program, and the runtime linker looks at that as well as the paths in the program (-rpath) and the default paths configured on the system. When you use static libraries, link-time is all that matters of course. When you use dynamic libraries you have to think about both. If you don't want to use -rpath at all you have three choices: either have your users always set LD_LIBRARY_PATH, or else have them install the shared libraries into the standard directories where the runtime linker will look (typically /lib and /usr/lib), or finally change the configuration of the runtime linker to look where you do install them (by modifying /etc/ld.so.conf--at least this is what it is on Linux) _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
