Menu

#267 Problem compiling libpng1.6.30 on ubuntu 16.04 amd64

libpng_code
open
None
5
2017-10-03
2017-07-14
andreafc
No

I'm having a problem compiling from source.
./configure doesn't complain about anything, but
make
returns the error
./.libs/libpng16.so: undefined reference to `inflateValidate'
collect2: error: ld returned 1 exit status
Makefile:1004: recipe for target 'pngfix' failed
make[1]: [pngfix] Error 1
make[1]: Leaving directory '/home/andrea/Downloads/graphviz/libpng-1.6.30'
Makefile:791: recipe for target 'all' failed
make:
[all] Error 2

zlib seems to be installed right (didn't get any error message in the process).

Discussion

  • Glenn Randers-Pehrson

    You need to install zlib-1.2.9 or later, preferably zlib-1.2.11. If you had already installed 1.2.11, then maybe the linker is finding another older zlib on your computer when linking pngfix.

     

    Last edit: Glenn Randers-Pehrson 2017-07-14
  • Glenn Randers-Pehrson

    • assigned_to: Glenn Randers-Pehrson
     
  • andreafc

    andreafc - 2017-07-20

    I did install 1.2.11 and it does look like the linker is finding an older version. I don't really know how to make the linker find the right one. What I have tried, based on googling around, is:

    • export LDFLAGS="-L/path/to/zlib-1.2.11/"
    • export CFLAGS="-I/path/to/zlib-1.2.11/"
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/zlib-1.2.11/
    • export ZLIB_LIBS="-L/home/andrea/Downloads/graphviz/zlib-1.2.11/"

    and now I get:

    make all-am
    make[1]: Entering directory /home/andrea/Downloads/graphviz/libpng-1.6.30' /bin/bash ./libtool --tag=CC --mode=link gcc -I/home/andrea/Downloads/graphviz/zlib-1.2.11/ -L/home/andrea/Downloads/graphviz/zlib-1.2.11/ -o pngfix contrib/tools/pngfix.o libpng16.la -lm -lz -lm libtool: link: gcc -I/home/andrea/Downloads/graphviz/zlib-1.2.11/ -o .libs/pngfix contrib/tools/pngfix.o -L/home/andrea/Downloads/graphviz/zlib-1.2.11/ ./.libs/libpng16.so -L/usr/lib -lz -lm ./.libs/libpng16.so: undefined reference toinflateValidate'
    collect2: error: ld returned 1 exit status
    make[1]: [pngfix] Error 1
    make[1]: Leaving directory `/home/andrea/Downloads/graphviz/libpng-1.6.30'
    make:
    [all] Error 2

    I'm obviously doing something worng, but I don't know what.

     
  • Glenn Randers-Pehrson

    This is not a terribly satisfactory solution, but you may be able to work around the problem by using --zprefix when you configure your new zlib. This may eliminate a conflict between your new zlib with the older one lurking on your system somewhere.

     

Log in to post a comment.