#64 libpng is not linking against zlib

open
makefiles (58)
5
2013-09-06
2005-11-26
Anonymous
No

I using makefile.linux. libpng library is not linking
against zlib, only png test programs are, so i needed
to add a -lz to the target for libpng.

I think the right solution is making libpng to link
with libz instead of forcing external applications to
link with libz. It's a libpng dependency.

I discovered this problem with a linking error using
gdk-pixbuf-csource binary from the gtk-2.8.6 package.

Discussion

  • Tybris

    Tybris - 2007-10-02

    Logged In: YES
    user_id=1500546
    Originator: NO

    Not sure if this is exactly the same issue, but for the purpose of porting to systems with pkg-config, but without dynamic libraries (e.g. Minix 3) it would be nice if the following was added to libpng.pc:

    Libs.private: -lz

    Which is returned by pkg-config when the --static flag is given. Otherwise compiling with libpng through pkg-config will give linking (undefined reference) errors.

    Regards,
    Marco

     
  • Glenn Randers-Pehrson

    Logged In: YES
    user_id=7859
    Originator: NO

    Wouldn't it also need -lm?

    i.e., Libs.private: -lz -lm

    Glenn

     
  • Tybris

    Tybris - 2007-10-02

    Logged In: YES
    user_id=1500546
    Originator: NO

    Yes, you're right. It isn't necesarry for Minix (GCC includes it by default), but in general that should be the case.

    Marco

     
  • Glenn Randers-Pehrson

    Logged In: YES
    user_id=7859
    Originator: NO

    Does libpng-1.2.21rc3 work for you? It adds -lz -lm (or sometimes just -lz) to Libs,
    not to Libs.private.

    Should we have a separate makefile.minix, without -lm (are there any other differences
    from makefile.linux?)

    Glenn

     
  • Nobody/Anonymous

    Logged In: NO

    > Does libpng-1.2.21rc3 work for you? It adds -lz -lm (or sometimes just
    > -lz) to Libs, not to Libs.private.

    libpng-1.2.21rc3 works for me, but doesn't add -lz or -lm to libpng.pc

    > Should we have a separate makefile.minix, without -lm (are there any other
    > differences from makefile.linux?)

    I see now some makefiles use sed to add the libraries to libpng.pc. This is probably the preferable method. There are some Minix specific caveats (like having two binary incompatible compilers). I'll see if I can create one.

    Meanwhile, couldn't we add a customizable configure variable to libpng.pc.in?

    Marco

     
  • Glenn Randers-Pehrson

    Logged In: YES
    user_id=7859
    Originator: NO

    >libpng-1.2.21rc3 works for me, but doesn't add -lz or -lm to libpng.pc

    That's curious. I get the following:

    Name: libpng
    Description: Loads and saves PNG files
    Version: 1.2.21rc3
    Libs: -L${libdir} -lpng12 -lz -lm
    Cflags: -I${includedir}

     
  • Nobody/Anonymous

    Logged In: NO

    Similar problem with Oct. 13/2007 build and the VC++ 6.0 project. Is there a place to just download the win32 lib?

     
  • Glenn Randers-Pehrson

    • Milestone: libpng-devel --> libpng_build_scripts
     
  • Jacques Pelletier

    I tried to compile libpng 1.6.3 with zlib 1.2.8 on Windows 98 (Cygwin) and Slackware.
    Both gave an error: undefined reference to _inflateReset
    Using libpng 1.5.17 compiled successfully on both platforms.

     
  • Glenn Randers-Pehrson

    libpng-1.5.17 and 1.6.3 are the same with respect to use of -lz and
    " #include < zlib.h > " so I don't see why one would work and not the other if
    you used the same the build script for both.

     
    Last edit: Glenn Randers-Pehrson 2013-09-06

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks