nakiya
nakiya

Reputation: 14413

Linking with --whole-archive flag

This problem is related to This question I asked yesterday. Now it seems that the linker flag --whole-archive forces the test object to be included in the binary. However, in linking with,

g++ main.cpp -o app -Wl,--whole-archive -L/home/dumindara/intest/test.a -Wl,-no--whole-archive

I get the following error:

/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lgcc_s

What to do?

Upvotes: 0

Views: 2356

Answers (1)

C. K. Young
C. K. Young

Reputation: 223023

.a files are meant to be statically linked, and so are not compiled with -fPIC. Consequently, you cannot make a shared library from it.

Upvotes: 2

Related Questions