Boost logo

Boost-Build :

From: Kirill Lapshin (klapshin_at_[hidden])
Date: 2003-12-26 22:04:36


Hello!

I've been happily using Boost.Build.V2 for quite a while now. Many
thanks to Volodya, Dave, and everyone contributing to the project.

The issue I have now is linkage errors with gcc. It is well known that
gcc is peaky about order of the siurces on command line, the most
generic libraries should appear at the end. For ages this problem was
worked around in bjam by adding the whole set of libraries twice. It
used to work just fine, but after one of recent changes I started
getting link errors. Rearranging order of libraries on the command line
fixes the errors, so it is not a bug in my setup. I am observing this
behaviour on cygwin with most recent cygwin gcc (3.3.1).

Any ideas what could be done to workaround/fix the problem? Maybe it is
time to implement smarter generation of command line? Since build system
knows the dependency tree, it should be possible to put libraries in
correct order. I have no idea how hard it is though..

After googling around for a while I found another solution, add -Wl,"-("
in the beginning of the list of libraries and -Wl,"-)" at the end. This
will make linker to repeatedly scan a group of libraries between the -(
and -) marks. Not sure what versions of linker support groups though.
Please find attached a trivial patch implementing grouping.

--Kirill
 --------------050801070807090509010802 Content-Type: text/x-patch;
name="gcc.jam.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="gcc.jam.diff"

--- gcc.jam.orig 2003-12-26 21:52:38.010936000 -0500
+++ gcc.jam 2003-12-26 21:49:48.857705600 -0500
@@ -108,7 +108,7 @@

actions link bind LIBRARIES
{
- $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
+ $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" "$(>)" -Wl,"-(" "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME) -Wl,"-)"
}

# Declare action for creating static libraries
@@ -126,7 +126,7 @@
# Differ from 'link' above only by -shared.
actions link.dll bind LIBRARIES
{
- $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
+ $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname,$(<[1]:D=) -shared "$(>)" -Wl,"-(" "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME) -Wl,"-)"
}

# Set up threading support. It's somewhat contrived, so perform it at the end,
 --------------050801070807090509010802--


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk