Boost logo

Boost-Build :

From: Tomas Puverle (Tomas.Puverle_at_[hidden])
Date: 2006-06-17 18:43:54


> gcc (GCC) 4.1.1 (OpenPKG-CURRENT)
> GNU ld version 2.16.1

> Caleb Epstein

Caleb,

My Solaris gcc is 3.4.5-2 and it looks like the linker is also GNU's:

$ <path-to-gcc>/g++ -print-prog-name=ld
<path-to-gcc>/ld
$ <path-to-gcc>/ld -v
GNU ld version 2.15.92.0.2 20040927

The behaviour you describe is not Solaris specific. Running g++ on
Linux exactly as you describe produces the same results. I think when
specifying the -Bstatic/dynamic, you need pass the options to the linker
instead of the compiler:

-Wl,-Bstatic -lgreet -Wl,-Bdynamic

This seems to work for me on both platforms. -Bstatic/dynamic on Suncc
do affect the linker but on gcc the -B option is in fact used to tell
the compiler where its subcomponents live:

<quote>
-Bprefix
           This option specifies where to find the executables,
libraries,
           include files, and data files of the compiler itself.

           The compiler driver program runs one or more of the
subprograms
           cpp, cc1, as and ld. It tries prefix as a prefix for each
program
           it tries to run, both with and without machine/version/.

           For each subprogram to be run, the compiler driver first
tries the
           -B prefix, if any. If that name is not found, or if -B was
not
           specified, the driver tries two standard prefixes, which are
           /usr/lib/gcc/ and /usr/local/lib/gcc/. If neither of those
results
           in a file name that is found, the unmodified program name is
           searched for using the directories specified in your PATH
           environment variable.

<snip rest of man>
</quote>

As you can see, what you are doing with -Bstatic is telling the g++ to
look for cc1 etc in a directory called "static", which I think is not
what you intended :) And since the linker always favours a dynamic
library over a static one, that explains why you always had a dependency
on libgreet.so.

Hope that helps,

Tom


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