Opened 9 years ago

#9350 new Bugs

boost does not use prefix for rpath

Reported by: Georg Sauthoff <mail@…> Owned by:
Milestone: To Be Determined Component: Building Boost
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

How to reproduce:

MY_PREFIX=/my/boost/target

./bootstrap.sh --prefix=$MY_PREFIX

./b2 -j 14 -d+2 address-model=64 install

ldd $MY_PREFIX/lib/libboost_filesystem.so | grep boost
   libboost_system.so.1.54.0 => NOT FOUND 

I've observed this issue with Boost 1.52 (using the sun toolset - sun.jam) and with Boost 1.54 (using the gcc toolset - gcc.jam).

It seems that boost sets the rpath to the build directory and not to the specified prefix (during link time).

Expected results:

ldd $MY_PREFIX/lib/libboost_filesystem.so | grep boost

libboost_system.so.1.54.0 => $MY_PREFIX/lib/libboost_system.so.1.54.0

(note that I've picked libboost_filesystem as an example - other boost libraries have the same issue, e.g. chrono/log/time/...)

Currently I use a dirty workaround to have the rpath set correctly:

--- a/tools/build/v2/tools/gcc.jam
+++ b/tools/build/v2/tools/gcc.jam
@@ -945,7 +945,7 @@ rule link ( targets * : sources * : properties * )
 
 actions link bind LIBRARIES
 {
-    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
+    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(MY_PREFIX)/lib -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
 }


@@ -1011,7 +1011,7 @@ rule link.dll ( targets * : sources * : properties * )
 # Differs from 'link' above only by -shared.
 actions link.dll bind LIBRARIES
 {
-    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
+    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(MY_PREFIX)/lib "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
 }

 rule setup-threading ( targets * : sources * : properties * )

The workaround for tools/build/v2/tools/sun.jam is similar.

Change History (0)

Note: See TracTickets for help on using tickets.