Boost logo

Boost-Build :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-09 10:28:50


Vladimir Prus <ghost_at_[hidden]> writes:

> Okay, I've nearly done with the <link> feauture and
> associated support for -l libraries. I do have a couple
> of questions for gcc gurus.
>
> 1. If I have two libraries, "a", and "b", and want to link
> the first one statically, and the second one dynamically,
> what should command line contain.
> If I try
>
> -Wl,-Bdynamic -la -Wl,-Bstatic -lb
>
> then it works on certain system. On another, this links
> both libraries statically, and I need
>
> -Wl,-Bdynamic -Wl,-la -Wl,-Bstatic -Wl,-lb

Hmm, this looks like some strangeness in the g++ front-end to the
linker. Jason, do you know anything about this?

> So, what's the rigt way?
>
> 2. Is it ever possible to link to static runtime if any lib
> is dynamic? For example, in default setting both "-lm" and "-lc"
> are linked dynamically. If I say
>
> -Wl,-Bdynamic -lz -Wl,Bstatic
>
> (here, the last element should affect runtime libs).
>
> Then, -lz is linked dynamically (that's right),
> "-lm" is linked statically (that's right, too),

How did libm get involved? I don't see it in the command-line.

> but "-lc" is linked dynamically (althought it's part of C
> runtime). I guess that's because "-lz" uses dynamic runtime.
>
> What to do about that? I'm inclined to do nothing.

Do you have any other options? If not, your choice is clear... ;->

> 3. I recall that somebody posted a table with various linker options
> for shared/static libraries a long time ago. Of course, I did not
> save that message, don't remember who's the author, and even
> don't remember which ml (boost or jamboost) that was on. No luck
> with searching. Has anybody a brigher memory?

Not I, sorry. It sounds like it might have been during my initial
exploratory phases, so it would have been on Boost. But I honestly
don't remember.

-- 
David Abrahams
dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
 

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