在Centos上构建,在安装PerlIO :: gzip时出现Zlib.h错误

时间:2018-06-19 05:38:33

标签: linux centos gzip zlib perl-module

我正在使用Centos6,尝试安装PerlIO :: gzip 我得到的错误是

gzip.xs:16:10: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^~~~~~~~
compilation terminated.
make: *** [gzip.o] Error 1

我该如何处理这个

我尝试过很多来自网络的解决方案,但都没有。其中一些如下:

yum install libpng libpng-devel

Package 2:libpng-1.2.49-2.el6_7.x86_64 already installed and latest version
Package 2:libpng-devel-1.2.49-2.el6_7.x86_64 already installed and latest version

sudo yum install libpng-devel gd-devel zlib-devel perl-ExtUtils-MakeMaker

Package 2:libpng-devel-1.2.49-2.el6_7.x86_64 already installed and latest version
Package gd-devel-2.0.35-11.el6.x86_64 already installed and latest version
Package zlib-devel-1.2.3-29.el6.x86_64 already installed and latest version
Package perl-ExtUtils-MakeMaker-6.55-144.el6.x86_64 already installed and latest version

sudo yum groupinstall&#34;开发工具&#34;

Package flex-2.5.35-9.el6.x86_64 already installed and latest version
Package gcc-4.4.7-18.el6_9.2.x86_64 already installed and latest version
Package redhat-rpm-config-9.0.3-51.el6.centos.noarch already installed and latest version
Package rpm-build-4.8.0-55.el6.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package patch-2.6-8.el6_9.x86_64 already installed and latest version
Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version
Package gettext-0.17-18.el6.x86_64 already installed and latest version
Package automake-1.11.1-4.el6.noarch already installed and latest version
Package bison-2.4.1-5.el6.x86_64 already installed and latest version
Package libtool-2.2.6-15.5.el6.x86_64 already installed and latest version
Package autoconf-2.63-5.1.el6.noarch already installed and latest version
Package gcc-c++-4.4.7-18.el6_9.2.x86_64 already installed and latest version
Package binutils-2.20.51.0.2-5.47.el6_9.1.x86_64 already installed and latest version
Package patchutils-0.3.1-3.1.el6.x86_64 already installed and latest version
Package byacc-1.9.20070509-7.el6.x86_64 already installed and latest version
Package indent-2.2.10-7.el6.x86_64 already installed and latest version
Package systemtap-2.9-7.el6.x86_64 already installed and latest version
Package diffstat-1.51-2.el6.x86_64 already installed and latest version
Package elfutils-0.164-2.el6.x86_64 already installed and latest version
Package cvs-1.11.23-16.el6.x86_64 already installed and latest version
Package rcs-5.7-37.el6.x86_64 already installed and latest version
Package subversion-1.6.11-15.el6_7.x86_64 already installed and latest version
Package gcc-gfortran-4.4.7-18.el6_9.2.x86_64 already installed and latest version
Package 1:doxygen-1.6.1-6.el6.x86_64 already installed and latest version
Package intltool-0.41.0-1.1.el6.noarch already installed and latest version
Package git-1.7.1-9.el6_9.x86_64 already installed and latest version
Package ctags-5.8-2.el6.x86_64 already installed and latest version
Package cscope-15.6-7.el6.x86_64 already installed and latest version
Package swig-1.3.40-6.el6.x86_64 already installed and latest version
Warning: Group development does not have any packages.
No packages in any requested group available to install or update

请帮助

4 个答案:

答案 0 :(得分:0)

尝试yum install perl-Compress-Zlib

答案 1 :(得分:0)

我什至尝试手动安装它,但无法成功。 请在下面找到详细信息

[root @ localhost PerlIO-gzip-0.20]#perl Makefile.PL

Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for PerlIO::gzip
Writing MYMETA.yml and MYMETA.json

[root @ localhost PerlIO-gzip-0.20]#make

cp gzip.pm blib/lib/PerlIO/gzip.pm
Running Mkbootstrap for gzip ()
chmod 644 "gzip.bs"
"/home/Ranjan/Softwares/Perl-5.26.1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- gzip.bs blib/arch/auto/PerlIO/gzip/gzip.bs 644
"/home/Ranjan/Softwares/Perl-5.26.1/bin/perl" "/home/Ranjan/Softwares/Perl-5.26.1/lib/perl5/5.26.1/ExtUtils/xsubpp"  -typemap '/home/Ranjan/Softwares/Perl-5.26.1/lib/perl5/5.26.1/ExtUtils/typemap'  gzip.xs > gzip.xsc
mv gzip.xsc gzip.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"0.20\" -DXS_VERSION=\"0.20\" -fPIC "-I/home/Ranjan/Softwares/Perl-5.26.1/lib/perl5/5.26.1/x86_64-linux-thread-multi/CORE"   gzip.c
gzip.xs:16:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.
make: *** [gzip.o] Error 1

答案 2 :(得分:0)

在Ubuntu上遇到了这个问题,解决方法是安装zlib1g-dev

cpan install PerlIO::gzip之后工作正常。

答案 3 :(得分:0)

我是在Fedora上做到这一点的,而这就是窍门:

sudo dnf install zlib-devel