libtool
[Top][All Lists]
Advanced

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

Re: exclusive static or shared


From: Christopher Hulbert
Subject: Re: exclusive static or shared
Date: Wed, 15 Feb 2006 06:28:59 -0500

On 2/15/06, Ralf Wildenhues <address@hidden> wrote:
> Hi Christopher,
>
> * Christopher Hulbert wrote on Tue, Feb 14, 2006 at 11:08:28PM CET:
> > I have a number of directories most of which I ONLY want to build
> > shared libraries from.  There are a couple that I ONLY want static
> > libraries.  Is there a way to turn on/off shared/static libraries.  I
> > saw -static which would work IF both build_old_libs=yes.  Is there any
> > way to have -static set build_old_libs=yes?  This is on cygwin with
> > libtool 1.5.22.  Is there a -shared equivelent to disable static and
> > enable shared library building?
>
> Here's a set of rules.
>
> The developer can set preferences on a per-(sub)package basis by using
>   AC_ENABLE_SHARED
>   AC_DISABLE_SHARED
>   AC_ENABLE_STATIC
>   AC_DISABLE_STATIC
> in the respective configure.ac files.
>
> The user can do so per-(sub)package with
>   --enable-shared=pkgs
>   --disable-shared=pkgs
>   --enable-static=pkgs
>   --disable-static=pkgs
> and override above macros thusly.

I guess I didn't make it clear enough that ALL the subdirectories were
under the same configure script and doesn't make logical sense to
split them.

>
> Assuming a package that uses Automake, the developer can control this on
> a per-library basis by putting
>   -static
> into the *LDFLAGS that affect libtool-created libraries.  The user can
> override this (usually on a per-make invocation basis) by using the flag
> in LDFLAGS, but has to make sure only libtool-created libraries (and not
> any other linked targets) are affected.

I had shared libraries enables and static disabled from configure.  In
passing -static to the 1  library I wanted to be static, it created
the library, but without any object files in it.  i.e. it was an empty
library and thus resulted in missing symbols later.  I found If I
enabled static libraries at configure time The objects would be put
in, but the 30 shared libraries I wanted all got useless static ones
built which wasted time and space.

>
> The developer or the user can possibly limit the types of libraries
> created by using the
>   --tag=disable-shared
>   --tag=disable-static
> tags for libtool.  To use these correctly, there are a few things to be
> noted though:
> - Shared libraries may not have been disabled at configure time.
> - These tags work with both 1.5.x and CVS libtool versions, but
>   are not (yet) documented.
> - These flags need to go before the compiler: speaking in Automake
>   terms, they would fit in LIBTOOLFLAGS but not in LDFLAGS.
> - We took liberty to change (fix) their semantics in 1.5.22 to this:
>   If you pass
>     --tag=disable-shared --tag=CXX
>   then previously, the CXX configuration could overwrite the disabling
>   of shared libraries.  Now that does not happen any more.
>   The new behavior (in branch-1-5 and HEAD) gives the disable-* tags
>   precedence over the language tags.
> - Until we document the tags, we'll probably take liberty to change them
>   again if we encounter more issues that we don't like.

The LIBTOOLFLAGS is the variable I was looking for!  Of course tag's
don't work in LDFLAGS because they come after the compiler (another
shot at the problem I took).  I will try setting LIBTOOLFLAGS later
today.

On a side note, I have started to dig into the libtool CVS internals
and have created a patch for the PGI wl="" and -link -dll problem I
was receiving.  When I get to work I will test these and submit them
to the libtool-patches list.

Chris

>
>
> With all of the aforementioned measures, one has to take the following
> additional rule into account:
> Libtool will never disable all types of libraries.  That means, it will
> usually fall back to static libraries because it is usually possible to
> create them everywhere.
>
> It is furthermore important to note that there are systems where libtool
> will not build static libraries by default (AIX without runtimelinking)
> or not build shared libraries at all.
>
> Hope that helps (and gives enough flexibility).
>
> Cheers,
> Ralf
>




reply via email to

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