pngfix。c:2151:对“inflateReset2”的未定义引用

时间:2021-05-11 05:30:57

My platform:

我的平台:

Centos 6.X, Matplotlib-1.3.1, Numpy-1.8.0, Scipy 0.14.0.dev-bb608ba

Centos 6。X, Matplotlib-1.3.1, Numpy-1.8.0, Scipy 0.14.0

I am trying to install libpng-1.6.6 to show .png files but when trying to make it is failing giving the below error.

我正在尝试安装libpng-1.6.6来显示.png文件,但是在尝试设置时,没有给出下面的错误。

NOTE: I have successfully pre-installed zlib (as well as freetype2) which is supposedly the error is pointing at.

注意:我已经成功地预安装了zlib(以及freetype2),这可能是错误所在。

pngfix.o: In function `zlib_reset':
/usr/lib/hue/libpng-1.6.6/contrib/tools/pngfix.c:2151: undefined reference to `inflateReset2'
collect2: ld returned 1 exit status
make[1]: *** [pngfix] Error 1
make[1]: Leaving directory `/usr/lib/hue/libpng-1.6.6'
make: *** [all] Error 2

Please see the link to my original thread matplotlib-pyplot-does-not-show-output-no-error

请查看我的原始线程matplotlib-pyplot-does-not-show-output-no-error的链接

I checked the 2151 line of pngfix.c. It is the zlib_reset function and has something to do with the rc settings. Is it pointing to change some matplotlibrc settings?

我查了2151行pngfix.c。它是zlib_reset函数,它与rc设置有关。它是指改变一些matplotlibrc设置吗?

   2136 zlib_reset(struct zlib *zlib, int window_bits)
   2137    /* Reinitializes a zlib with a different window_bits */
   2138 {
   2139    assert(zlib->state >= 0); /* initialized by zlib_init */
   2140
   2141    zlib->z.next_in = Z_NULL;
   2142    zlib->z.avail_in = 0;
   2143    zlib->z.next_out = Z_NULL;
   2144    zlib->z.avail_out = 0;
   2145
   2146    zlib->window_bits = window_bits;
   2147    zlib->compressed_digits = 0;
   2148    zlib->uncompressed_digits = 0;
   2149
   2150    zlib->state = 0; /* initialized, once */
   2151    zlib->rc = inflateReset2(&zlib->z, 0);
   2152    if (zlib->rc != Z_OK)
   2153    {
   2154       zlib_message(zlib, 1/*unexpected*/);
   2155       return 0;
   2156    }
   2157
   2158    return 1;
   2159 }

3 个解决方案

#1


4  

The problem with libpng install is solved.

解决了libpng安装的问题。

The reason for the failure apparently appears to be version incompatibility, partly may be due to libpng-1.6.6 being unstable and has conflict with the zlib-1.2.8 being previously installed.

失败的原因显然是版本不兼容,部分原因可能是libpg -1.6.6不稳定,并且与之前安装的zlib-1.2.8发生冲突。

I uninstalled zlib-1.2.8 and reinstalled the older but stable release zlib-1.2.7 and instead of libpng-1.6.6, downloaded and installed libpng-1.5.9 and libpng installation passed the test successfully!

我卸载了zlib-1.2.8,重新安装了旧但稳定的zlib-1.2.7版本,而不是libpng-1.6.6,下载并安装libpng-1.5.9和libpng安装成功地通过了测试!

There was no zlib_reset - 'inflateReset2' problem this time. Don't know if there was a better solution, but I seemed to have bypassed the problem anyway. So the ideal compatible versions are zlib-1.2.7/libpng-1.5.9 instead of zlib-1.2.8/libpng-1.6.6 which I had been trying! Hope this helps.

这次没有zlib_reset - 'inflateReset2'问题。我不知道是否有更好的解决办法,但我似乎已经避开了这个问题。所以理想的兼容版本是zlib-1.2.7/libpng-1.5.9,而不是我一直在尝试的zlib-1.2.8/libpng-1.6.6 !希望这个有帮助。

#2


3  

I had the same problem ("undefined reference to `inflateReset2'"), and tried libpng-1.6.6 and libpng-1.6.13 in combination with both zlib-1.2.8 and zlib-1.2.7. Nothing worked!

我遇到了同样的问题(“对‘inflateReset2’的未定义引用”),并尝试将libpng-1.6.6和libpng-1.6.13与zlib-1.2.8和zlib-1.2.7结合使用。没有工作!

Then I came across this helpful post: https://*.com/a/21345713

然后我遇到了这个有用的帖子:https://*.com/a/21345713

What happens is that libpng uses libtools for compiling and linking, and libtools by default only looks for libraries and headers in /usr/lib and /usr/include. So if you've installed a newer version of zlib manually in a local directory, libtools doesn't find it while trying to build libpng, and the error results from the requirement of libpng for a newer version of zlib.

libpng使用libtools进行编译和链接,libtools默认只在/usr/lib和/usr/ include中查找库和头文件。因此,如果您已经在本地目录中手动安装了更新的zlib版本,那么libtools在尝试构建libpng时不会找到它,错误的原因是libpng对新版本zlib的要求。

The solution is to simply run ./configure with LDFLAGS and CPPFLAGS set to the lib and include directory where the newer version of zlib was installed. In my case:

解决方案是简单地运行./配置,使用设置为lib的LDFLAGS和CPPFLAGS,并包含安装新版本zlib的目录。在我的例子中:

LDFLAGS=-L$HOME/.local/lib CPPFLAGS=-I$HOME/.local/include ./configure --prefix=$HOME/.local

Hope this helps!

希望这可以帮助!

#3


1  

I would argue Flo's is best. Worked for me on centos 6.5.

我认为弗洛是最好的。在centos 6.5工作。

More specifically:

更具体地说:

sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure

#1


4  

The problem with libpng install is solved.

解决了libpng安装的问题。

The reason for the failure apparently appears to be version incompatibility, partly may be due to libpng-1.6.6 being unstable and has conflict with the zlib-1.2.8 being previously installed.

失败的原因显然是版本不兼容,部分原因可能是libpg -1.6.6不稳定,并且与之前安装的zlib-1.2.8发生冲突。

I uninstalled zlib-1.2.8 and reinstalled the older but stable release zlib-1.2.7 and instead of libpng-1.6.6, downloaded and installed libpng-1.5.9 and libpng installation passed the test successfully!

我卸载了zlib-1.2.8,重新安装了旧但稳定的zlib-1.2.7版本,而不是libpng-1.6.6,下载并安装libpng-1.5.9和libpng安装成功地通过了测试!

There was no zlib_reset - 'inflateReset2' problem this time. Don't know if there was a better solution, but I seemed to have bypassed the problem anyway. So the ideal compatible versions are zlib-1.2.7/libpng-1.5.9 instead of zlib-1.2.8/libpng-1.6.6 which I had been trying! Hope this helps.

这次没有zlib_reset - 'inflateReset2'问题。我不知道是否有更好的解决办法,但我似乎已经避开了这个问题。所以理想的兼容版本是zlib-1.2.7/libpng-1.5.9,而不是我一直在尝试的zlib-1.2.8/libpng-1.6.6 !希望这个有帮助。

#2


3  

I had the same problem ("undefined reference to `inflateReset2'"), and tried libpng-1.6.6 and libpng-1.6.13 in combination with both zlib-1.2.8 and zlib-1.2.7. Nothing worked!

我遇到了同样的问题(“对‘inflateReset2’的未定义引用”),并尝试将libpng-1.6.6和libpng-1.6.13与zlib-1.2.8和zlib-1.2.7结合使用。没有工作!

Then I came across this helpful post: https://*.com/a/21345713

然后我遇到了这个有用的帖子:https://*.com/a/21345713

What happens is that libpng uses libtools for compiling and linking, and libtools by default only looks for libraries and headers in /usr/lib and /usr/include. So if you've installed a newer version of zlib manually in a local directory, libtools doesn't find it while trying to build libpng, and the error results from the requirement of libpng for a newer version of zlib.

libpng使用libtools进行编译和链接,libtools默认只在/usr/lib和/usr/ include中查找库和头文件。因此,如果您已经在本地目录中手动安装了更新的zlib版本,那么libtools在尝试构建libpng时不会找到它,错误的原因是libpng对新版本zlib的要求。

The solution is to simply run ./configure with LDFLAGS and CPPFLAGS set to the lib and include directory where the newer version of zlib was installed. In my case:

解决方案是简单地运行./配置,使用设置为lib的LDFLAGS和CPPFLAGS,并包含安装新版本zlib的目录。在我的例子中:

LDFLAGS=-L$HOME/.local/lib CPPFLAGS=-I$HOME/.local/include ./configure --prefix=$HOME/.local

Hope this helps!

希望这可以帮助!

#3


1  

I would argue Flo's is best. Worked for me on centos 6.5.

我认为弗洛是最好的。在centos 6.5工作。

More specifically:

更具体地说:

sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure