|
Boost-Build : |
From: Jürgen Hunold (hunold_at_[hidden])
Date: 2004-11-11 08:23:22
Hi !
I've got some trouble when running
bjam gcc-3.4 release/link-runtime=static/link=static
that means building a complete static executable.
My problem is I use gcc-3.4.1 installed in /usr/local/gcc-3.4.1.
I've defined to toolset in user-config.jam to read:
using gcc : 3.4 : /usr/local/gcc-3.4.1/bin/g++ :
<linkflags>-L/usr/local/gcc-3.4.1/lib ;
in order to get the library path correct.
Unfortunately, bjam output something like
"/usr/local/gcc-3.4.1/bin/g++"
-L"/usr/X11/lib" -L"/usr/lib" -L"/usr/local/qt-3.3.2/lib"
-o output-file
<list of libraries>
-static -L/usr/local/gcc-3.4.1/lib -Wl,--strip-all -pthread
that means the library path for g++ is append after the list of
libraries and therefore meaningless. This leads to lots of linker
errors because the correct libstdc++.a is not found.
When I manually change the command-line to read
"/usr/local/gcc-3.4.1/bin/g++"
-L"/usr/X11/lib" -L"/usr/lib" -L"/usr/local/qt-3.3.2/lib"
-L/usr/local/gcc-3.4.1/lib
-o output-file
<list of libraries>
-static -Wl,--strip-all -pthread
I get a statically linked executable. Cool ;-)
I've looked at the source and found that _all_ extra toolset-options are
simply added to OPTIONS in common.jam at line 259 which value is append
to rest of the commandline in gcc.jam at line 263.
Inetrestingly, sun.jam does prepend the OPTION an line 91.
So, I'm not sure how to resolve this.
The only thing I know for sure is that the custom link options in
toolset initialisation should be inserted _before_ all other option in
order to override them.
It is quite hard to get an example because the differences between
gcc-3.3 (libstdc++.5) and gcc-3.4 (libstdc++.6) are quite hard to
locate ;-))
Yours,
Jürgen
-- * Dipl.-Math. Jürgen Hunold ! Institut für Verkehrswesen, Eisenbahnbau * voice: ++49 511 762-2529 ! und -betrieb, Universität Hannover * fax : ++49 511 762-3001 ! Appelstrasse 9a, D-30167 Hannover * hunold_at_[hidden] ! www.ive.uni-hannover.de
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