Linker options to statically link a lib*.a file while creating a shared object

Posted by Swaroop S on Stack Overflow See other posts from Stack Overflow or by Swaroop S
Published on 2010-06-18T12:37:04Z Indexed on 2010/06/18 12:43 UTC
Read the original article Hit count: 405

Filed under:
|
|

How can I tell the linker that statically link libfoo.a while building the shared object sharedobj.so using gcc/make.

I have tried to pass the LDFLAG options LDFLAGS += -W1 --whole-archive -L/path/to/libfoo -lfoo

I have also tried to pass LDFLAGS the options LDFLAGS += -W1, static -L/path/to/libfoo -lfoo

I have also tried to pass LDFLAGS the options LDFLAGS += -W1, Bstatic -L/path/to/libfoo -lfoo

and

I have also tried to pass LDFLAGS the options LDFLAGS += -W1, statically_linked -L/path/to/libfoo -lfoo

I have read through a number of links that tell me how to do it but none have worked so far.

© Stack Overflow or respective owner

Related posts about c++

Related posts about makefile