如何在 Windows 上安装 Perl 的 GD 图形库?
有人设法在 Windows (Win7) 上安装 Perl (5.10) 的 GD
模块吗?请注意,不幸的是,这既不是 ActivePerl 也不是 Strawberry Perl;相反,它是使用 MinGW 自编译的。
我已将 GD 库解压到 C:\Opt\GDlib
中。有 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 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
即使我添加 < code>C:\Opt\GDlib\bin 到 PATH
以便找到 GD 二进制文件。
然后我什至不确定要调用哪个 make: mingw32-make
、dmake
或某些可能仍然丢失的 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 模块已经为 Strawberry 和 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.
Has anyone managed to install the GD
module for Perl (5.10) on Windows (Win7)? Note that unfortunately this is neither ActivePerl nor Strawberry Perl; instead, it is a self-compiled using MinGW.
I have unpacked the GD library in C:\Opt\GDlib
. There are bin
, lib
and include
directories.
I have MinGW tools sitting in C:\Opt\MinGW\bin\*.exe
, including gcc
and mingw32-make.exe
(but no plain make
).
I'm running the Microsoft script to set up INCLUDE
, LIBPATH
and LIB
.
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
If I don't do this, the following Windows libraries are reported missing when I run 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
After running the Microsoft script, only the following is reported:
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
That warning persists even when I add C:\Opt\GDlib\bin
to PATH
so the GD binaries will be found.
I'm then not even sure which make to call: mingw32-make
, dmake
, or some make
that might still be missing? Here's the error output I'm seeing:
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
I'd be thankful for anyone who can shed light on what I'm supposed to do here. I suspect I'm missing the basics of how to compile using MinGW on Windows.
UPDATE - Following Neil's suggestion to give TDM-GCC a try
Here's the screen output. Still no success, but I guess it's just me ignoring some trivialities. In the end, the GD module has been built for both Strawberry and ActiveState, so there definitely is a way.
vsvars32
set path=%path%;C:\Opt\GDlib\bin
cpan
Then in the 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须构建并安装 Perl 的底层 libgd GD,以及 使用您的构建环境提到的其他库(使用与构建
perl
相同的编译器和设置)。您不应该将 VC 环境与 MinGW 混合。
我更喜欢坚持使用 Windows SDK 7.1 捆绑的编译器/构建工具 对于一切,从从源代码构建 Perl 开始。
You have to build and install the underlying libgd which Perl's GD, as well as the other libraries mentioned using your build environment (using the same compiler and settings used to build your
perl
).You should not mix your VC environment with MinGW.
I prefer to stick with the compiler/build tools bundled with Windows SDK 7.1 for everything, starting with building Perl from source.
听起来您的 MinGW 安装有问题。你从哪里得到它的?您应该尝试 http://tdm-gcc.tdragon.net 上的版本。另外,该 .bat 文件适用于 Microsoft 编译器,而不适用于 MinGW。
Sounds like there is a problem with your MinGW installation. where did you get it from? You should try the version at http://tdm-gcc.tdragon.net. also, that .bat file is for the Microsoft compiler, not for MinGW.