Opened 14 years ago
Closed 14 years ago
#2579 closed Bugs (invalid)
Linking libboost_filesystem may need an rpath
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | Boost 1.38.0 | Component: | Building Boost |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | Cc: |
Description
This is on FreeBSD 6.1, where the rpath of an executable is separate from the rpaths of the shared libraries it links with.
I have built boost 1.37.0 and installed it in a private directory, for use with another project. After linking the other project, I examined it with ldd to check if I had got the library search paths correct.
I found that although some boost libraries could be found, one was not found (libboost_system-gcc42-mt-1_37.so.1.37.0).
It turned out that libboost_system-* was required by libboost_filesystem-*, but since there was no RPATH option specified when linking, it was not found.
I worked around it by re-linking libboost_filesystem-* while the environment variable LD_RUN_PATH was set to the private library directory. A proper solution would pass --rpath (or equivalent) to the linker. (Unfortunately how to pass this option varies somewhat between systems: -R, -Wl,-R, -Wl,--rpath, -wL,-rpath, etc etc)
This is not a bug. If you wish rpath to be added to libraries, add "dll-path=xxx" to bjam command line. This is not done by default, because opinions differ as to whether hardcoding rpaths like this is good idea.