How can I install Perl's GD graphics library on Windows? - perl

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.

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.

Related

Cannot build Perl libgd on Mac Perlbrew environment

I was using Mac OS 12 and Perlbrew with Perl 5.36.
When I install GD using either CPAN or cpanm I get the following error:
cpanm (App::cpanminus) 1.7046 on perl 5.036000 built for darwin-2level
Work directory is /Users/mjb/.cpanm/work/1673722431.48328
You have make /usr/bin/make
You have LWP 6.67
You have /usr/bin/tar: bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8
You have /usr/bin/unzip
Searching install () on cpanmetadb ...
install is up to date. (0.01)
Searching GD () on cpanmetadb ...
--> Working on GD
Fetching http://www.cpan.org/authors/id/R/RU/RURBAN/GD-2.76.tar.gz
-> OK
Unpacking GD-2.76.tar.gz
Entering GD-2.76
Checking configure dependencies from META.json
Checking if you have ExtUtils::Constant 0.22 ... Yes (0.25)
Checking if you have ExtUtils::PkgConfig 0 ... Yes (1.16)
Configuring GD-2.76
Running Makefile.PL
Notice: Type perl Makefile.PL -h for command-line option summary.
Package gdlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `gdlib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gdlib' found
at Makefile.PL line 530.
*** can not find package gdlib
*** check that it is properly installed and available in PKG_CONFIG_PATH
at Makefile.PL line 530.
-> N/A
-> FAIL Configure failed for GD-2.76. See /Users/mjb/.cpanm/work/1673722431.48328/build.log for details.
The above is the contents of build.log. I'm not sure how to investigate further or fix it.
Previously I had Perl's GD install and build using the system Perl. I also have libgd installed from Homebrew and I included /usr/local/lib in the env var PKG_CONFIG_PATH. Still no avail.
Would appreciate help as I rely upon GD for my personal projects. Thanks.
Found it... something (probably me botching my .zshrc) had unset my $PKG_CONFIG_PATH!
After finding out what pkg-config was and scouring my drive for any telling collection of .pc files, I found gdlib.pc under /usr/local/lib/pkgconfig/gdlib.pc.
Then I simply did an export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ and reran the installation. Perl's GD built and installed without grumbling.
A pernanment solution will be to add the above line to your ~/.zshrc.

How to install dmake with perl?

Can someone please tell me how to download dmake with Perl?
I have tried with CPAN, but this is what I get:
cpan> install dmake
Database was generated on Wed, 10 Jul 2019 10:13:05 GMT
Running install for module 'dmake'
'" "' is not recognized as an internal or external command,
operable program or batch file.
Checksum for C:\STRAWB~1\cpan\sources\authors\id\S\SH\SHAY\dmake-4.12.2.2.zip ok
Scanning cache C:\STRAWB~1\cpan\build for sizes
............................................................................DONE
Package contains both files[ChangeLog COPYING dmake.exe META.yml NEWS PATCH.TXT README.TXT] and directories[man readme startup]; not recognized as a perl package, giving up
Configuring S/SH/SHAY/dmake-4.12.2.2.zip with Makefile.PL
Running make for S/SH/SHAY/dmake-4.12.2.2.zip
gmake: *** No targets specified and no makefile found. Stop.
SHAY/dmake-4.12.2.2.zip
C:\STRAWB~1\c\bin\gmake.exe -- NOT OK
Stopping: 'install' failed for 'dmake'.
Failed during this command:
SHAY/dmake-4.12.2.2.zip : writemakefile NO -- Package contains both files[ChangeLog COPYING dmake.exe META.yml NEWS PATCH.TXT README.TXT] and directories[man readme startup]; not recognized as a perl package, giving up
I have also tried with ppm install dmake, but I got this:
Installing package 'dmake'...
Error installing package 'dmake': Could not locate a PPD file for package dmake
Not answering the question because it's a XY problem, but giving you the info you need.
The most recent mod_perl2 compiled for Strawberry is against Perl 5.12, which is long out of support. Using any other version of Perl is not going to work. You should ask ApTest to update and recompile for a current Strawberry and release a new setup_spmp helper. They are relying on a dead piece of tech (mod_perl2), so they should either support the required dependency properly or move their application onto a modern stack.

CPAN install module meet make file not ok issue

I'm trying to run this script on my computer (MAC)
http://mkweb.bcgsc.ca/color-summarizer/?download
It's the first time in my life touching the terminal... so you understand that I ask very basic questions. please do forgive me...
basically when i execute the script, I would always get this kind of message :
Can't locate Imager/File/GIF.pm in #INC (you may need to install the
Imager::File::GIF module) (#INC contains:
/Applications/colorsummarizer/colorsummarizer-0.77/bin/lib
/Applications/colorsummarizer/colorsummarizer-0.77/bin/../lib
/Applications/colorsummarizer/colorsummarizer-0.77/bin
/Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18
/Network/Library/Perl/5.18/darwin-thread-multi-2level
/Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-
multi-2level /Library/Perl/Updates/5.18.2
/System/Library/Perl/5.18/darwin-thread-multi-2level
/System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-
thread-multi-2level /System/Library/Perl/Extras/5.18) at
/Library/Perl/5.18/darwin-thread-multi-2level/Imager.pm line 1677.
And so I use :
sudo cpan install Imager::File::GIF
for example. But the I get this :
Warning (mostly harmless): No library found for -lgif
GIF: Test code failed: Can't link/include 'gif_lib.h', 'stdio.h',
'errno.h', 'string.h', 'gif'
OS unsupported: GIF libraries or headers not found
Warning: No success on command[/usr/bin/perl Makefile.PL]
TONYC/Imager-File-GIF-0.91.tar.gz
/usr/bin/perl Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
And ! it seems like even when I appear to install something successfully, The system ask me to re-install them again and again and again...
Maybe I did some very fundamental mistakes ?
Thanks a lot for your attention
The issue identified by the following message is not harmless at all, actually:
Warning (mostly harmless): No library found for -lgif
GIF: Test code failed: Can't link/include 'gif_lib.h', 'stdio.h',
'errno.h', 'string.h', 'gif'
The module uses libgif to do all the heavy work, but it's not installed. Furthermore, the installation procedure needs the library's header files.
Imager::File::GIF provides GIF file format support for Imager.
It requires libgif to be installed, including development headers.
For Linux distributions this typically requires installation of the
associated -dev or -devel package.
Installing the required library and header files might be as simple as asking your OS's package manager to install libgif-dev or libgif-devel.
Try to just install Imager like this, it might be all you need:
sudo cpan Imager
After that it could open gifs for me.

How to install Image::Magick in perl version 5.18

I need to install Image::Magick module in a machine and the credentials are below:
Windows Version - 7
Perl Version 5.18
Also I have tried so many ways like cpan ppm and also copied the module and directly pasted in the c:\perl\lib\ and c:\perl\site\lib and unfortunately no luck.
In cpan installed
Running install for module 'Image::Magick'
Running make for J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz
Checksum for C:\Perl\cpan\sources\authors\id\J\JC\JCRISTY\PerlMagick-6.89-1.tar.gz ok
./PerlMagick-6.89/
./PerlMagick-6.89/check.sh
./PerlMagick-6.89/Makefile.old
./PerlMagick-6.89/Makefile.nt
./PerlMagick-6.89/check.sh.in
./PerlMagick-6.89/demo/
./PerlMagick-6.89/demo/README
............
./PerlMagick-6.89/t/bzlib/read.t
./PerlMagick-6.89/t/input.fits
./PerlMagick-6.89/Makefile.PL
./PerlMagick-6.89/Makefile.PL.in
./PerlMagick-6.89/MANIFEST.SKIP
./PerlMagick-6.89/Makefile.am
./PerlMagick-6.89/Magick.xs
./PerlMagick-6.89/check
CPAN.pm: Building J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
JCRISTY/PerlMagick-6.89-1.tar.gz
[31m C:\Perl\bin\dmake.exe -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
################################## WARNING! ####################
It seems that you are trying to install Perl::Magick on a MS Wi
perl + gcc compiler (e.g. strawberry perl), however we cannot f
binaries installed on your system.
Please check the following prerequisites:
You need to have installed ImageMagick Windows binaries from
https://www.imagemagick.org/script/download.php#windows
We only support dynamic (DLL) ImageMagick binaries
note: it is not possible to mix 32/64-bit binaries of perl a
During installation select that you want to install ImageMag
development files (libraries+headers)
You also need to have ImageMagick's directory in your PATH
note: we are checking the presence of convert.exe and/or ide
You might need Visual C++ Redistributable Package installed
see instructions on ImageMagick's Binary Release webpage
We are gonna continue, but chances for successful build are ver
################################################################
Warning (mostly harmless): No library found for -lMagickCore
Warning (mostly harmless): No library found for -lmoldname
Warning (mostly harmless): No library found for -lkernel32
Warning (mostly harmless): No library found for -luser32
Warning (mostly harmless): No library found for -lgdi32
Warning (mostly harmless): No library found for -lwinspool
Warning (mostly harmless): No library found for -lcomdlg32
Warning (mostly harmless): No library found for -ladvapi32
Warning (mostly harmless): No library found for -lshell32
Warning (mostly harmless): No library found for -lole32
Warning (mostly harmless): No library found for -loleaut32
Warning (mostly harmless): No library found for -lnetapi32
Warning (mostly harmless): No library found for -luuid
Warning (mostly harmless): No library found for -lws2_32
Warning (mostly harmless): No library found for -lmpr
Warning (mostly harmless): No library found for -lwinmm
Warning (mostly harmless): No library found for -lversion
Warning (mostly harmless): No library found for -lodbc32
Warning (mostly harmless): No library found for -lodbccp32
Warning (mostly harmless): No library found for -lcomctl32
to undefined at C:/Perl/lib/ExtUtils/Install.pm line 1198.
C:\Perl\bin\dmake.exe: *** [pm_to_blib] Error 2
Failed during this command:
JCRISTY/PerlMagick-6.89-1.tar.gz : make NO
cpan> exit
Lockfile removed.
After Installation the error displays as:
D:>perl -wc test.pl
Can't locate Image/Magick.pm in #INC (you may need to install the >Image::Magick module) (#INC contains: C:/Perl/site/lib C:/Perl/lib .) at test.pl line 2.
BEGIN failed--compilation aborted at test.pl line 2.
It would be appreciated if someone could suggest the way to close this.
The Perl library Image::Magick is a wrapper around a C library called ImageMagick. You can't install the Perl library if the C library is not installed first. That's why your attempted cpan installation gave all of those "No library found" errors.
You can download the Windows version of ImageMagick from the project's web site. Once you have installed that, you can try to install the Perl library again.
Did you read the errors that you got from cpan? I'm really not sure why, after getting a message saying "install seems impossible" you would try running a test program!

Cannot install GD module on darwin 13.0.1 using cpan

I'm having a tough job trying to get GD installed. I'm running a Mas OSX 10.9.2 darwin 13.0.1
When I run this:
cpan[1]> install GD
perl -MCPAN -e shell
I get the follwing error:
cpan[1]> install GD
Reading '/Users/me/.cpan/Metadata'
Database was generated on Sun, 21 Dec 2014 18:53:17 GMT
Running install for module 'GD'
Running make for L/LD/LDS/GD-2.56.tar.gz
Checksum for /Users/me/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
CPAN.pm: Building L/LD/LDS/GD-2.56.tar.gz
Configuring for libgd version 2.0.11.
Checking for stray libgd header files...none found.
GD library used from: /usr/local
Please choose the features that match how libgd was built:
Undefined subroutine &main::prompt called at Build.PL line 169.
Warning: No success on command[/usr/bin/perl Build.PL ]
'YAML' not installed, will not store persistent state
LDS/GD-2.56.tar.gz
/usr/bin/perl Build.PL -- NOT OK
Running Build test
Make had some problems, won't test
Running Build install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Failed during this command:
LDS/GD-2.56.tar.gz : writemakefile NO '/usr/bin/perl Build.PL ' returned status 512
Build.PL is trying to call a function called prompt but it doesn't exist. This is because they recently switched build systems from ExtUtils::MakeMaker (Makefile.PL) to Module::Build (Build.PL) but didn't fully convert the program. I've reported the bug.
Most people don't notice this because the prompting is only necessary if GD can't configure itself. It does this by looking for the gdlib-config program. If that can't be found, or it doesn't work, it will ask you for your gdlib configuration. It's best to let gdlib-config take care of that. Best way to solve this problem is to make sure gdlib-config is somewhere in your PATH and that gdlib-config --all works.
Otherwise replace all the instances of prompt in Build.PL with Module::Build->prompt and it should work.
I'm not sure about doing this on OSX, but I recently had similar problems with installing CPAN modules on CentOS.
Some prerequisite modules simply wouldn't install properly from CPAN. These modules had RPMs available. After installing some of the prerequisites via yum, I was able to get CPAN to install the modules I needed.
In particular, I had to install Module-Build and Archive-Tar (which brought in a number of other dependency rpm's) using yum.
Hope this helps.