'Using automake/libtool to link shared library with static non-automake-generated lib
In my shared library foo I link static library bar as follows:
foo_la_LIBADD = /path/to/bar.lib
When linking, I get the following:
*** Warning: Trying to link with static lib archive /path/to/bar.lib.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because the file extensions .lib of this argument makes me believe
*** that it is just a static archive that I should not use here.
and the link fails.
bar.lib is effectively an intermediate convenience archive, but it is not produced by automake.
I can fix the issue by hand-generating a bar.la wrapper for bar.lib with
old_library='bar.lib'
shouldnotlink=no
but that seems like a gruesome hack I would prefer to avoid. Is there a better way to fix this?
Solution 1:[1]
Adjust libtool.m4 (similar to this os2 patch) - or the generated configure script - to generate
deplibs_check_method="pass_all"
in the generated libtool script; or (if you can do this after running configure) change it directly in there.
This way you'll get a warning
*** Warning: Linking the shared library test.la against the
*** static library /path/to/bar.lib is not portable!
and everything will still link.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
