libpng16.so: undefined reference to `inflateValidate'

by Sergey Gatich   Last Updated April 17, 2017 10:00 AM

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.



Answers 2


The solution was to add LDDFLAGS to ./configure:

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

This solved the issue.

Sergey Gatich
Sergey Gatich
February 09, 2017 19:36 PM

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
Stephane
Stephane
April 17, 2017 09:08 AM

Related Questions


AWS EC2 deleted but still shows current usage

Updated June 06, 2020 19:00 PM


how to get public ip of instance using cloud formation

Updated October 13, 2018 03:00 AM