如何在Windows上安装Perl的GD图形库?

时间:2011-05-25 15:12:51

标签: perl mingw gd

有没有人设法在Windows(Win7)上为Perl(5.10)安装GD模块?请注意,遗憾的是,这既不是ActivePerl也不是Strawberry Perl;相反,它是使用MinGW进行自编译的。

我已在C:\Opt\GDlib中解压缩了GD库。有binlibinclude个目录。

我有C:\Opt\MinGW\bin\*.exe的MinGW工具,包括gccmingw32-make.exe(但没有普通make)。

我正在运行Microsoft脚本来设置INCLUDELIBPATHLIB

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"

如果我不这样做,则在运行perl Makefile.PL时会报告以下Windows库丢失:


oldnames.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
netapi32.lib
uuid.lib
ws2_32.lib
mpr.lib
winmm.lib
version.lib
odbc32.lib
odbccp32.lib
msvcrt.lib

运行Microsoft脚本后,仅报告以下内容:

    Note (probably harmless): No library found for -lfreetype
    Note (probably harmless): No library found for -ljpeg
    Note (probably harmless): No library found for -lpng
    Note (probably harmless): No library found for -lz

即使我将C:\Opt\GDlib\bin添加到PATH,警告仍然存在,因此可以找到GD二进制文件。

我甚至不确定要拨打哪个电话:mingw32-makedmake或某些可能仍然遗失的make?这是我看到的错误输出:

C:\.cpan\build\GD-2.46-baFt6a :: mingw32-make
mingw32-make: *** No rule to make target `C:\epages\Perl\libConfig.pm', needed by `Makefile'.  Stop.

C:\.cpan\build\GD-2.46-baFt6a :: dmake
dmake.exe:  Error: -- `C:\epages\Perl\libConfig.pm' not found, and can't be made

我要感谢任何能够阐明我应该在这里做什么的人。我怀疑我错过了如何在Windows上使用MinGW进行编译的基础知识。

更新 - 遵循Neil建议尝试使用TDM-GCC

这是屏幕输出。仍然没有成功,但我想这只是我无视一些琐事。最后,GD模块已经为草莓和ActiveState构建了,所以肯定有办法。

vsvars32
set path=%path%;C:\Opt\GDlib\bin
cpan

然后在cpan shell中:

cpan[1]> look GD
CPAN: Storable loaded ok (v2.18)
Going to read \.cpan\Metadata
  Database was generated on Wed, 25 May 2011 13:37:34 GMT
CPAN: YAML loaded ok (v0.72)
Going to read \.cpan\build/
............................................................................DONE
Found 13 old builds, restored the state of 11
Running look for module 'GD'

Trying to open a subshell in the build directory...
Working directory is \.cpan\build\GD-2.46-baFt6a
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

C:\.cpan\build\GD-2.46-baFt6a :: perl Makefile.PL
Notice: Type perl Makefile.PL -h for command-line option summary.

Der Befehl "gdlib-config" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
**UNRECOVERABLE ERROR**
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.

C:\.cpan\build\GD-2.46-baFt6a :: perl Makefile.PL --ignore_missing_gd
Der Befehl "gdlib-config" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

Where is libgd installed? [/usr/lib] C:\opt\gdlib

Please choose the features that match how libgd was built:
Build JPEG support? [y]
Build PNG support? [y]
Build FreeType support? [y]
Build GIF support? [y]
Build support for animated GIFs? [y]

If you experience compile problems, please check the @INC, @LIBPATH and @LIBS
arrays defined in Makefile.PL and manually adjust, if necessary.

Note (probably harmless): No library found for -lfreetype
Note (probably harmless): No library found for -ljpeg
Note (probably harmless): No library found for -lpng
Note (probably harmless): No library found for -lz
Writing Makefile for GD

C:\.cpan\build\GD-2.46-baFt6a :: which mingw32-make
C:\Opt\MinGW32-TDM-GCC\bin\mingw32-make.EXE

C:\.cpan\build\GD-2.46-baFt6a :: mingw32-make
mingw32-make: *** No rule to make target `C:\epages\Perl\libConfig.pm', needed by `Makefile'.  Stop.

2 个答案:

答案 0 :(得分:0)

听起来你的MinGW安装有问题。你是从哪里得到的?您应该尝试http://tdm-gcc.tdragon.net处的版本。另外,.bat文件适用于Microsoft编译器,不适用于MinGW。

答案 1 :(得分:0)

您必须使用您的构建环境(使用相同的编译器和设置)构建和安装Perl的libgd以及GD的基础other libraries建立你的perl)。

您不应将VC环境与MinGW混合使用。

我更喜欢坚持使用与Windows SDK 7.1捆绑在一起的编译器/构建工具,从源代码构建Perl开始。