How can I install Perl's GD graphics library on Windows?
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-co开发者_开发百科nfig" 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.
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.
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.
精彩评论