4

By default, libtool creates two versions of library - static one and dynamic one and that's what I need. I also need that my library, no matter what type is it - static or dynamic, will be linked statically against certain dependencies (several .a archives - lib1.a, lib2.a and lib3.a). I tried --whole-archive option in _LDFLAGS like this:

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

but after Makefile generation, these flags are moved at the end of command, thus no effect is taken:

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

I also tried to provide --static flag in _LDADD like this:

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

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

How one should achieve this?

peetonn
  • 2,942
  • 4
  • 32
  • 49

1 Answers1

0
mylib_la_LIBADD=-llib1 -llib2 -llib3...

should work. Linking DSOs to static libs may not work, depending on how objects in the static lib were built.

ldav1s
  • 15,885
  • 2
  • 53
  • 56