Re: Linking against static libraries in Windows (MSYS)

Bob Friesenhahn <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
On Mon, 27 Jun 2016, Alex wrote:
>
> $ ./configure --disable-shared --enable-static --prefix=/usr
> $ make && make install
>
> But when I build *A* afterwards the following warning appears:
>
> *** Warning: This system can not link to static lib archive /usr/lib/
> libogg.la.
> *** 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.
>
> Has anybody come across this? Is there any known fix or workaround?

This is a common problem, which is not specific to MinGW or MSYS.

The two possible solutions are to either arrange to link with 
'B' while linking any application which depends on 'A', or else build 
'B' as libtool convenience library so that all symbols from 'B' now 
become part of 'A'.

Since in this case, the user may not expect symbols from libogg to be 
part of library 'A' (and perhaps multiple libraries similar to 'A' may 
also want to link with it), I doubt that the libtool convenience 
library approach is the correct one here.  Duplicate symbols due to 
mutual dependence need to be avoided.

The good news is that libtool will already automatically link 
dependency libraries when you build something which depends on 'A' and 
the .la file for 'A' is present.  In other words, libtool should 
handle the problem automatically as long as you don't do something to 
intentionally break it (e.g. delete the .la file) or link using 
something other than libtool.  This is a core function of libtool.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.