2011-05-25 40 views
0

是否有人设法在Windows(Win7)上为Perl(5.10)安装GD模块?请注意,不幸的是,这既不是ActivePerl也不是Strawberry Perl;相反,它是使用MinGW自编的。我已经解压GD库C:\Opt\GDlib。有bin,libinclude目录。如何在Windows上安装Perl的GD图形库?

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

我正在运行Microsoft脚本来设置INCLUDE,LIBPATHLIB

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

如果我不这样做,报告下面的Windows库丢失,当我运行perl Makefile.PL

 

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-make,dmakemake可能仍然会丢失?这里是我看到的错误输出:

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进行编译的基础知识。

更新 - 继尼尔的建议给TDM-GCC一试

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

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

然后在CPAN命令:

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. 

回答

0

你必须建立和安装基本libgd这Perl的GD,还有other libraries使用您的构建环境中提到(使用相同的编译器和设置用于制作perl)。

您不应该将您的VC环境与MinGW混用。

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

+0

谢谢,思南。同时,我已经离开这个环境(毕竟是三年前),对GD的需求消失了,所以我不会把你的建议付诸实践。不过,你的建议是健全的。当我问这个问题时,我对构建问题毫无头绪。 – Lumi 2014-10-08 19:49:42

0

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

+0

谢谢 - 我从[SourceForge](http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/)获得了我的MinGW,看起来是[MinGW主页](http://www.mingw.org/wiki/Getting_Started)的链接。我会试一试你的建议。 – Lumi 2011-05-25 15:41:50

+0

MinGW的主页非常好用 - TDM的构建非常好。 – 2011-05-25 15:44:31

+0

我已经使用TDM更新了我的问题,使用了cpan shell会话的记录。仍然没有成功。我想知道'perl Makefile.PL'是否生成了'Makefile'的正确风格?哦,我认为它没有。它有这样一行:'MAKE = nmake' – Lumi 2011-05-25 16:29:13