GNU Automake - creating dynamic libraries statically linked to its dependencies

By default, libtool creates two versions of the library - static and dynamic, as well as what I need. I also need my library, no matter what type it is static or dynamic, to be statically linked with some dependencies (several .a archives - lib1.a, lib2.a and lib3.a). I tried the option --whole-archivein the _LDFLAGSfollowing way:

mylib_la_LDFLAGS=...-Wl,--whole-archive, -llib1 -llib2 -llib3 --no-whole-archive ....

but after creating the Makefile, these flags move at the end of the command, so no effect is taken:

...-llib1 -llib2 -lib3.... -Wl,--whole-archive, --no-whole-arvhive,...

I also tried providing the flag --staticin the _LDADDfollowing way:

mylib_la_LDFLAGS=...--static -llib1 -llib2 -llib3 ....

and this flag is omitted when libtool creates a dynamic library (static library is ok).

How can this be achieved?

+4
1
mylib_la_LIBADD=-llib1 -llib2 -llib3...

. DSO libs , , lib.

0

Source: https://habr.com/ru/post/1610839/


All Articles