Image :: Magick on Strawberry Perl 5.12

时间:2012-03-05 13:36:51

标签: perl imagemagick

我正在尝试在Windows XP上的Strawberry Perl 5.12上安装Image::Magick,但在生成makefile时却找不到ImageMagick模块。 make也会引发很多编译错误。

我完成了Image::Magic自述文件中的内容:

Installation - Win32 Strawberry perl

    On Win32 Strawberry Perl the preferred way of installing PerlMagick is the
    following:

    1) Download and install ImageMagick Windows binaries from
    http://www.imagemagick.org/script/binary-releases.php#windows

    2) You HAVE TO choose dynamic (DLL) ImageMagick binaries.  Note: it is not
    possible to mix 32/64bit binaries of Perl and ImageMagick

    3) During installation select that you want to install ImageMagick's
    development files (libraries+headers)

    4) You NEED TO have ImageMagick's directory in your PATH.  Note: we are
    checking the presence of convert.exe or identify.exe tools

    5) You might need Visual C++ Redistributable Package installed on your
    system. See instructions on ImageMagick's Binary Release webpage.

    6) If you have all prerequisites 1)...5) you can simply install
    ImageMagick by running: cpan -i Image::Magick

我得到了这个:

################################### WARNING! ###################################
# It seems that you are trying to install Perl::Magick on a MS Windows box with
# perl + gcc compiler (e.g. Strawberry Perl), however we cannot find ImageMagick
# binaries installed on your system.
#
# Please check the following prerequisites:
#
# 1) You need to have installed ImageMagick Windows binaries from
#    http://www.imagemagick.org/script/binary-releases.php#windows
#
# 2) We only support dynamic (DLL) ImageMagick binaries
#    note: it is not possible to mix 32/64-bit binaries of perl and ImageMagick
#
# 3) During installation select that you want to install ImageMagick's
#    development files (libraries+headers)
#
# 4) You also need to have ImageMagick's directory in your PATH
#    note: we are checking the presence of convert.exe and/or identify.exe tools
#
# 5) You might need Visual C++ Redistributable Package installed on your system
#    see instructions on ImageMagick's Binary Release webpage
#
# We are gonna continue, but chances for successful build are very low!
################################################################################
Note (probably harmless): No library found for -lMagickCore
Note (probably harmless): No library found for -lmoldname
Note (probably harmless): No library found for -lkernel32
Note (probably harmless): No library found for -luser32
Note (probably harmless): No library found for -lgdi32
Note (probably harmless): No library found for -lwinspool
Note (probably harmless): No library found for -lcomdlg32
Note (probably harmless): No library found for -ladvapi32
Note (probably harmless): No library found for -lshell32
Note (probably harmless): No library found for -lole32
Note (probably harmless): No library found for -loleaut32
Note (probably harmless): No library found for -lnetapi32
Note (probably harmless): No library found for -luuid
Note (probably harmless): No library found for -lws2_32
Note (probably harmless): No library found for -lmpr
Note (probably harmless): No library found for -lwinmm
Note (probably harmless): No library found for -lversion
Note (probably harmless): No library found for -lodbc32
Note (probably harmless): No library found for -lodbccp32
Note (probably harmless): No library found for -lcomctl32
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json

但ImageMagick二进制文件已安装在路径变量中。

如何让它运行?

2 个答案:

答案 0 :(得分:2)

我有一个解决方案!

问题是,Makefile.pl在错误的目录中查找二进制文件。

  1. 获取最新的ImageMagick包。 click
  2. 解压缩并导航到PerlMagick文件夹
  3. 在编辑器中打开Makefile.pl
  4. 看看第一个foreach区块:
  5. foreach my $line (split '\n', $conf) {

    if ($line =~ /^Path:\s+(.*)/) {
      my ($vol,$dir,$file) = splitpath($1);
      next unless $dir;
      my $dirpath = catpath( $vol, $dir);
      my (@l,@b,@i) = ( (),(),() );
    
      # try to detect 'lib' dir
      push @l, catfile($dirpath,'..','lib');
      push @l, catfile($dirpath,'..','..','lib');
      push @l, catfile($dirpath,'..','..','..','lib');
      foreach (@l) { push @libdir, $_ if (-d $_) };
    
      # try to detect 'bin' dir
      push @b, catfile($dirpath,'..');
      push @b, catfile($dirpath,'..','bin');
      push @b, catfile($dirpath,'..','..');
      push @b, catfile($dirpath,'..','..','bin');
      push @b, catfile($dirpath,'..','..','..');
      push @b, catfile($dirpath,'..','..','..','bin');
      foreach (@b) { push @bindir, $_ if (-e "$_/convert.exe" || -e "$_/identify.exe") };
    
      # try to detect 'include' dir
      push @i, catfile($dirpath,'..','include');
      push @i, catfile($dirpath,'..','include','ImageMagick');
      push @i, catfile($dirpath,'..','..','include');
      push @i, catfile($dirpath,'..','..','include','ImageMagick');
      push @i, catfile($dirpath,'..','..','..','include');
      push @i, catfile($dirpath,'..','..','..','include','ImageMagick');
      foreach (@i) { push @incdir, $_ if (-e "$_/magick/MagickCore.h") };
    }
    

    if ($line =~ /^Path:\s+(.*)/) { my ($vol,$dir,$file) = splitpath($1); next unless $dir; my $dirpath = catpath( $vol, $dir); my (@l,@b,@i) = ( (),(),() ); # try to detect 'lib' dir push @l, catfile($dirpath,'..','lib'); push @l, catfile($dirpath,'..','..','lib'); push @l, catfile($dirpath,'..','..','..','lib'); foreach (@l) { push @libdir, $_ if (-d $_) }; # try to detect 'bin' dir push @b, catfile($dirpath,'..'); push @b, catfile($dirpath,'..','bin'); push @b, catfile($dirpath,'..','..'); push @b, catfile($dirpath,'..','..','bin'); push @b, catfile($dirpath,'..','..','..'); push @b, catfile($dirpath,'..','..','..','bin'); foreach (@b) { push @bindir, $_ if (-e "$_/convert.exe" || -e "$_/identify.exe") }; # try to detect 'include' dir push @i, catfile($dirpath,'..','include'); push @i, catfile($dirpath,'..','include','ImageMagick'); push @i, catfile($dirpath,'..','..','include'); push @i, catfile($dirpath,'..','..','include','ImageMagick'); push @i, catfile($dirpath,'..','..','..','include'); push @i, catfile($dirpath,'..','..','..','include','ImageMagick'); foreach (@i) { push @incdir, $_ if (-e "$_/magick/MagickCore.h") }; }

    脚本从%PATH%获取IM安装的位置,并查找bin,lib和include文件夹。它看起来无处不在,除了它的实际位置。

    所以你只需要添加这些:

    }
    

    之后,您可以执行# try to detect 'lib' dir push @l, catfile($dirpath,'lib'); ... # try to detect 'bin' dir push @b, catfile($dirpath); ... # try to detect 'include' dir push @i, catfile($dirpath,'include'); ... ,它将正确生成makefile。然后只需说出perl Makefile.pldmake即可。

    我希望有时可以帮助某人。

答案 1 :(得分:1)

你也可以尝试一种不那么痛苦的方法--Perl Perl附带的Perl包管理器。

以“ppm”命令开头,然后输入“install Image-Magick”。 30秒,你就完成了。