Possible Duplicate:
Can I mix static and shared-object libraries when linking?
I want to compile my app, linking statically only boost_system library. Other(glibc and etc) should be linked dynamically. How can i do it?
My command to compile dynamically:
g++ -o newserver server.cpp ... -lboost_system -std=c++0x
Command to compile statically:
g++ -static -o newserver server.cpp ... -pthread -lboost_system -std=c++0x
But this command link statically all! And app weights 2mb more!
Can you advice me what command to compile statically only boost lib?
Thanks!
Replace -lboost_system
with -Wl,-Bstatic -lboost_system -Wl,-Bdynamic
. The -Wl
option sends the thing after it to the linker, in the order it appears on the command-line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With