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

问题描述

| 是否有人设法在Windows(Win7)上为Perl(5.10)安装ѭ0模块?注意,不幸的是,这既不是ActivePerl也不是StrawBerry Perl。相反,它是使用MinGW自行编译的。 我在
C:\\Opt\\GDlib
中解压缩了GD库。有
bin
lib
include
目录。 我的MinGW工具位于
C:\\Opt\\MinGW\\bin\\*.exe
中,包括
gcc
mingw32-make.exe
(但没有普通的
make
)。 我正在运行Microsoft脚本来设置
INCLUDE
LIBPATH
LIB
\"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 版本库 odbc32.lib odbccp32.lib msvcrt.lib 运行Microsoft脚本后,仅报告以下内容:     注意(可能无害):未找到-lfreetype的库     注意(可能无害):未找到-ljpeg的库     注意(可能无害):未找到-lpng的库     注意(可能无害):未找到-lz的库 即使我在
PATH
添加
C:\\Opt\\GDlib\\bin
,该警告仍然存在,因此将找到GD二进制文件。 然后,我什至不知道该打哪个电话:
mingw32-make
dmake
或某些可能仍缺少的some8ѭ?这是我看到的错误输出: C:\\。cpan \\ build \\ GD-2.46-baFt6a :: mingw32-make mingw32-make:***没有规则可以使目标文件“ C:\\ epages \\ Perl \\ libConfig.pm \”,而“ Makefile \”则需要。停止。 C:\\。cpan \\ build \\ GD-2.46-baFt6a :: dmake dmake.exe:错误:-找不到C:\ epagesPerllibConfig.pm 我将感谢任何能够阐明我在这里应该做什么的人。我怀疑我缺少如何在Windows上使用MinGW进行编译的基础知识。 更新-遵循尼尔的建议尝试TDM-GCC 这是屏幕输出。仍然没有成功,但是我想只是我忽略了一些琐碎的事情。最后,已经为StrawBerry和ActiveState构建了GD模块,因此肯定有一种方法
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.
    

解决方法

您必须使用构建环境(使用用于构建lib21ѭ的相同编译器和设置)来构建和安装Perl GD的基础libgd,以及提到的其他库。 您不应将VC环境与MinGW混合使用。 我更喜欢坚持与Windows SDK 7.1捆绑在一起的编译器/构建工具,从从源代码构建Perl开始。     ,听起来您的MinGW安装有问题。你从哪里得到的?您应该在http://tdm-gcc.tdragon.net上尝试该版本。同样,该.bat文件适用于Microsoft编译器,不适用于MinGW。