[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking against static libraries in Windows (MSYS)

From: Bob Friesenhahn
Subject: Re: Linking against static libraries in Windows (MSYS)
Date: Mon, 27 Jun 2016 12:18:40 -0500 (CDT)
User-agent: Alpine 2.20 (GSO 67 2015-01-07)

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/
*** 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 Friesenhahn
GraphicsMagick Maintainer,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]