2

I'm just reporting. I faced an issue while tried to build libpng on Amazon Linux (Red Hat based). But I got following error:

libtool: link: gcc -g -O2 -o .libs/pngfix contrib/tools/pngfix.o  ./.libs/libpng16.so -lz -lm
./.libs/libpng16.so: undefined reference to `inflateValidate'
collect2: error: ld returned 1 exit status

I checked environment variables and they were set normally. nm tool displayed that inflateValidate was in zlib library exports. I hope my solution (see below) will help somebody and will save his time.

2

The solution was to add LDDFLAGS to ./configure:

./configure --prefix=/usr LDFLAGS="-L/usr/lib -lz"

This solved the issue.

| improve this answer | |
0

Running, on Lubuntu 16-04 on a 64 bits box, my solution was to specify the path to the zlib library.

First, build the zlib library:

./configure \
  --prefix=/home/stephane/programs/install
make
make install
make clean

Then, build the libpng library by specifying the dependency with the --with-zlib-prefix option:

./configure \
  --prefix=/home/stephane/programs/install \
  --with-zlib-prefix=/home/stephane/programs/install
make
make install
make clean
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.