automake
[Top][All Lists]
Advanced

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

Re: Help with static linking


From: Kip Warner
Subject: Re: Help with static linking
Date: Sat, 01 Jun 2013 16:42:43 -0700

On Fri, 2013-05-31 at 07:37 -0700, Dan Kegel wrote:
> You have
> > PKG_CHECK_MODULES([libzzip], [zziplib], [have_zzip=yes], [have_zzip=no])
> Have you seen
> https://bugs.freedesktop.org/show_bug.cgi?id=19541
> ?  Maybe try PKG_CHECK_MODULES_STATIC
> or PKG_CONFIG="pkg-config --static"

Hey Dan. I've actually already tried both approaches, but no luck. In
the case of at least zziplib, take a look at the following:

        $ pkg-config --libs zziplib
        -Wl,-Bsymbolic-functions -Wl,-z,relro -lzzip -lz
        
        $ pkg-config --static --libs zziplib
        -Wl,-Bsymbolic-functions -Wl,-z,relro -lzzip -lz

They both dump the same linker flags. Maybe I'm doing something wrong
here, or PKG_CHECK_MODULES_STATIC can't be any more useful than the
pkg-config metadata tags a package ships with it. This is the contents
of zziplib.pc:

        # generated by configure / remove this line to disable
        regeneration
        prefix=/usr
        exec_prefix=${prefix}
        bindir=${exec_prefix}/bin
        libdir=${exec_prefix}/lib
        datarootdir=${prefix}/share
        datadir=${prefix}/share
        sysconfdir=/etc
        includedir=${prefix}/include
        package=zziplib
        suffix=
        
        Name: zziplib
        Description: ZZipLib - libZ-based ZIP-access Library
        Version: 0.13.56
        Requires: zzip-zlib-config
        Libs: -L${libdir} -Wl,-Bsymbolic-functions -Wl,-z,relro -lzzip
        Cflags: -I${includedir} -D_FORTIFY_SOURCE=2

I don't see any .private tags. But based on what I can see, the package
seems to ship both a shared object runtime and a static library:

        $ dpkg -L libzzip-dev
        ...
        /usr/lib/libzzip.a
        ...
        /usr/lib/libzzip.so
        ...

> Never heard of libzzip, I can see why you don't want to expect it to
> be on the user's system already.

Yup.

> Is libpng a problem because its soname isn't the same everywhere yet?
> http://www.linuxbase.org/navigator/browse/lib_single.php?cmd=list-by-name&Section=ABI&Lname=libpng12

I actually don't know about that issue. However, based on the LSB link,
it says the library is pretty ubiquitous from what I'm reading. So I'll
take your word for it. But it would still be an issue if someone wants
to compile my application for w32/64 where the library will definitely
not ship by default.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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