How do I install GD for Perl?

4.1k views Asked by At

I tried to install it but it gave an error. I don't know what -lwebp is.

$ cpan install GD
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: Storable loaded ok (v2.53_01)
Reading '/home/Chloe/.cpan/Metadata'
  Database was generated on Sat, 24 Dec 2016 21:17:02 GMT
Running install for module 'GD'
CPAN: Digest::SHA loaded ok (v5.96)
CPAN: Compress::Zlib loaded ok (v2.069)
Checksum for /home/Chloe/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok
CPAN: YAML loaded ok (v1.20)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v1.4417)
CPAN: CPAN::Meta loaded ok (v2.150005)
CPAN: Module::CoreList loaded ok (v5.20160320)
CPAN: Module::Build loaded ok (v0.4216)
Configuring L/LD/LDS/GD-2.56.tar.gz with Build.PL
CPAN: CPAN::Reporter loaded ok (v1.2018)
gdlib-config: warning: this script is deprecated; please use the pkg-config file instead.
Configuring for libgd version 2.2.3.
Checking for stray libgd header files...none found.

Included Features:          GD_GIF GD_GIFANIM GD_OPENPOLYGON GD_ZLIB GD_PNG GD_FREETYPE GD_FONTCONFIG GD_JPEG GD_XPM GD_TIFF GD_WEBP
GD library used from:       /usr
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'GD' version '2.56'
(/usr/bin/perl Build.PL exited with 0)
CPAN::Reporter: Build.PL result is 'pass', No errors.
  LDS/GD-2.56.tar.gz
  /usr/bin/perl Build.PL -- OK
Running Build for L/LD/LDS/GD-2.56.tar.gz
Building GD
Extracting Image.pm (with variable substitutions)
gcc -I/usr/include -I/usr/lib/perl5/5.22/i686-cygwin-threads-64int/CORE -DVERSION="2.56" -DXS_VERSION="2.56" -DHAVE_JPEG -DHAVE_FT -DHAVE_XPM -DHAVE_GIF -DHAVE_PNG -DHAVE_FONTCONFIG -c -DPERL_USE_SAFE_PUTENV -D_GNU_SOURCE -U__STRICT_ANSI__ -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.22.2-1 -fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.22.2=/usr/src/debug/perl-5.22.2-1 -fwrapv -fno-strict-aliasing -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O3 -o lib/GD.o lib/GD.c
lib/GD.xs: In function ‘XS_GD__Image_stringFT’:
lib/GD.xs:2187:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
             img = (gdImagePtr) tmp;
                   ^
ExtUtils::Mkbootstrap::Mkbootstrap('blib/arch/auto/GD/GD.bs')
g++ --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong -o blib/arch/auto/GD/GD.dll lib/GD.o /usr/lib/perl5/5.22/i686-cygwin-threads-64int/CORE/libperl.dll.a -L/usr/lib -lz -lpng16 -lfreetype -lfontconfig -lfreetype -ljpeg -lXpm -lX11 -ltiff -lwebp -liconv -lgd
/usr/lib/gcc/i686-pc-cygwin/5.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lwebp
collect2: error: ld returned 1 exit status
error building blib/arch/auto/GD/GD.dll from lib/GD.o at /usr/lib/perl5/site_perl/5.22/ExtUtils/CBuilder/Base.pm line 321.
(./Build exited with 512)
CPAN::Reporter: Build result is 'unknown', Stopped with an error.
CPAN::Reporter: preparing a CPAN Testers report for GD-2.56
Do you want to review or edit the test report? (yes/no) [no] no
Do you want to send the report? (yes/no) [yes] yes
CPAN::Reporter: sending test report with 'unknown' via Metabase
  LDS/GD-2.56.tar.gz
  ./Build -- NOT OK

I have libgd-devel installed. This is a different error than (CPAN GD module install failure using Cygwin). CPAN Testers says GD installed OK

http://www.cpantesters.org/distro/G/GD.html

Windows 8.1 64bit, Cygwin 2.6.1 32bit, Perl v5.22.2


I installed libwebp and libwebp-devel from setup-x86 and now it says it succeeded but the tests failed.

CPAN::Reporter: Build result is 'pass', No errors.
  LDS/GD-2.56.tar.gz
  ./Build -- OK
Running Build test
# Testing using gd2 support.

#   Failed test 'image comparison test 7'
#   at t/GD.t line 249.
# Looks like you failed 1 test of 11.
t/GD.t ........
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/11 subtests
t/Polyline.t .. ok

Test Summary Report
-------------------
t/GD.t      (Wstat: 256 Tests: 11 Failed: 1)
  Failed test:  9
  Non-zero exit status: 1
Files=2, Tests=12,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.19 cusr  0.12 csys =  0.34 CPU)
Result: FAIL
Failed 1/2 test programs. 1/12 subtests failed.
(./Build test exited with 65280)
CPAN::Reporter: Test result is 'fail', One or more tests failed.
1

There are 1 answers

0
Armali On BEST ANSWER

2.53 worked! Also this might be useful: stackoverflow.com/questions/260593/… You have to use install L/LD/LDS/GD-2.53.tar.gz from within CPAN as it doesn't work on the command line. – Chloe