在Fedora上安装Perl Image :: Magick

时间:2015-02-17 04:13:03

标签: perl imagemagick

我正在通过cpan安装Image :: Magick并且我一直收到此错误。我试过和不强迫它。我已经修剪了安装日志。我已经阅读了一些关于错过ImageMagick.h文件的内容,但是当时并没有完全了解其他内容。显然这是自2007年以来的常见问题.....

[gandalf@Durmstrang ~]$ cpan -if Image::Magick

"/usr/bin/perl" "/usr/share/perl5/vendor_perl/ExtUtils/xsubpp"  -typemap "/usr/share/perl5/ExtUtils/typemap" -typemap "typemap"  Magick.xs > Magick.xsc && mv Magick.xsc Magick.c
gcc -c  -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-6" -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic   -DVERSION=\"6.89\" -DXS_VERSION=\"6.89\" -fPIC "-I/usr/lib64/perl5/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs: In function ‘XS_Image__Magick_ComplexImages’:
Magick.xs:3475:5: error: unknown type name ‘ComplexOperator’
     ComplexOperator
     ^
Magick.xs:3510:8: error: ‘UndefinedComplexOperator’ undeclared (first use in this function)
     op=UndefinedComplexOperator;
        ^
Magick.xs:3510:8: note: each undeclared identifier is reported only once for each function it appears in
Magick.xs:3516:31: error: ‘MagickComplexOptions’ undeclared (first use in this function)
         in=ParseCommandOption(MagickComplexOptions,MagickFalse,(char *)
                               ^
Magick.xs:3524:13: error: ‘ComplexOperator’ undeclared (first use in this function)
         op=(ComplexOperator) in;
             ^
Magick.xs:3524:30: error: expected ‘;’ before ‘in’
         op=(ComplexOperator) in;
                              ^
Magick.xs:3548:38: error: expected ‘;’ before ‘in’
                 op=(ComplexOperator) in;
                                      ^
Magick.xs:3563:5: warning: implicit declaration of function ‘ComplexImages’ [-Wimplicit-function-declaration]
     image=ComplexImages(image,op,exception);
     ^
Magick.xs:3563:10: warning: assignment makes pointer from integer without a cast [enabled by default]
     image=ComplexImages(image,op,exception);
          ^
Magick.xs: In function ‘XS_Image__Magick_Mogrify’:
Magick.xs:9824:11: warning: implicit declaration of function ‘RotationalBlurImageChannel’ [-Wimplicit-function-declaration]
           image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
           ^
Magick.xs:9824:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
                ^
Magick.xs:10895:11: warning: implicit declaration of function ‘CannyEdgeImage’ [-Wimplicit-function-declaration]
           image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
           ^
Magick.xs:10895:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
                ^
Magick.xs:10916:11: warning: implicit declaration of function ‘HoughLineImage’ [-Wimplicit-function-declaration]
           image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
           ^
Magick.xs:10916:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
                ^
Magick.xs:10939:11: warning: implicit declaration of function ‘MeanShiftImage’ [-Wimplicit-function-declaration]
           image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
           ^
Magick.xs:10939:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
                ^
make: *** [Magick.o] Error 1
  JCRISTY/PerlMagick-6.89-1.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

2 个答案:

答案 0 :(得分:3)

问题是CPAN不了解非Perl依赖项。

Perl Image :: Magick模块只是一个C库的包装器。在构建Perl模块之前,您需要安装该库。

$ sudo yum install ImageMagick

它也可能需要ImageMagick的开发包。

$ sudo yum install ImageMagick-devel

但是,安装已经为Fedora打包的RPM版本可能更容易(这将自动引入任何其他要求)。

$ sudo yum install ImageMagick-perl

答案 1 :(得分:2)

在Fedora,CentOS,Ubuntu等中,通过cpan程序安装Image :: Magick时遇到了这种类型的挑战,并且对于Image :: Magick的安装脚本存在敏感性。多年来,似乎(如果一个人搜索)。这对于桌面Linux来说都是如此,更是如此,通过Apache cpanel。有收件人,但至少在Ubuntu,他们没有解决所有问题。有时,要做到正确,首先必须使用ImageMagick删除相关库以重置链接。在使用“cpan”之前,所有提出的解决方案都围绕着安装其他内容。但是,我发现,最好的方法是从源代码编译,但是在可用时安装二进制ImageMagick应用程序,以及在cpan之前和之后安装相关库,就像这样 - 在Ubuntu中,但适用于Fedora应该类似或大致相同:

sudo apt-get install perlmagick
sudo apt-get install ImageMagick
sudo cpan install Image::Magick
sudo apt-get install libperl-dev

为了完整起见,如果找不到合适的二进制文件,必须注意预先安装http://www.imagemagick.org上指示的所有相关库,然后这组命令将替换上面的第2行,当执行时在' sudo -i'之后(在Ubuntu中)或Fedora中的等价物,在临时文件夹中:

wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd Imag*
./configure --with-perl
make
make install

完成此安装后,请继续执行上面的第3行。将命令的开头调整为适合其他形式的linux的表单。在此之后,在其开始时使用Image :: Magick; 的perl程序应该能够完美地调整jpg图像的大小等。