Linking statically only boosts g ++ library

Possible duplicate:
Can I mix libraries of static and shared objects during layout?

I want to compile my application statically linking only the boost_system library. Others (glibc, etc.) Must be linked dynamically. How can i do this?

My command to compile dynamically:

g++  -o newserver  server.cpp ... -lboost_system -std=c++0x

The command to compile statically is:

g++ -static  -o newserver  server.cpp ... -pthread -lboost_system -std=c++0x

But this command links everything statically! And the weight of the 2mb application is more!

Can you advise me which command to compile statically, only boost lib?

Thank!

+5
source share
2 answers

-lboost_system -Wl,-Bstatic -lboost_system -Wl,-Bdynamic. -Wl , .

+6

. -Bstatic -Bdynamic , , . , , , . - : , , -L -L general .

, Boost, , , .so. g++ ( -Bstatic -Bdynamic), . , , , , . , , .

+2

All Articles