Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-13 09:25:17

Hi Andre,

> How do I force a library to be linked statically with gcc? By looking at
> gcc.jam, it seems that <find-static-library> does not enforce static
> linking.

Right, not anymore, because I'm completely unsure how this can be reasonably
done. I've a couple of question to you:

1. Why do you need static linking to a specific library?
2. One approach is to use:

g++ ..... -Wl,-Bstatic -lwhatever

however this will fail if there's no static version of whatever. Also, there's
assymentry with:

g++ ..... -Wl,-Bshared -lwhatever

which will link to if present, but will also link with whatever.a,
not fail. Is the '-Bstatic' behaviour what you're after? I'm a bit worried by
its platform-specificity.

While we discuss this, you can use

<linkflags>"-Wl,-Bstatic -lwhatever"

to make your project work.

- Volodya


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at