Libs collapsing question

Kevin Fox Kevin.Fox at
Tue Nov 9 13:39:59 PST 2010

I have two libraries that are only ever static. libfoo.a and libbar.a

They are used to build shared libraries, and I want to link everything
in the static library into the resulting binary.

I want to create two pc files to define how to link these libraries.

The Libs lines look like the following, respectively:
Libs: -Wl,--whole-archive ${libdir}/libfoo.a -Wl,--no-whole-archive
Libs: -Wl,--whole-archive ${libdir}/libbar.a -Wl,--no-whole-archive

When used together, pkg-config unfortunately collapses the linker lines

me at test:~src$ pkg-config --libs foo bar
-Wl,--whole-archive /usr/lib/libfoo.a
-Wl,--no-whole-archive /usr/lib/libbar.a

Making the second library not copy all symbols in. Is there any way to
make pkg-config ignore argument collapsing in this sort of situation?


More information about the pkg-config mailing list