问题
I have looked and seen similar issues posted but am unable to get GD working. the following error arises with libgd and libpng installed...
clang -c -I/usr/local/include -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include -Wformat=0 -Os -DVERSION=\"2.50\" -DXS_VERSION=\"2.50\" "-I/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE" -DHAVE_FT -DHAVE_GIF -DHAVE_ANIMGIF -DVERSION_33 -DHAVE_UNCLOSEDPOLY -DHAVE_FTCIRCLE GD.c
GD.xs:997:18: warning: implicit declaration of function 'gdImageGifAnimBeginPtr' is invalid in C99 [-Wimplicit-function-declaration]
data = (void *) gdImageGifAnimBeginPtr(image,&size,globalcm,loops);
^
GD.xs:1022:18: warning: implicit declaration of function 'gdImageGifAnimAddPtr' is invalid in C99 [-Wimplicit-function-declaration]
data = (void *) gdImageGifAnimAddPtr(image,&size,localcm,leftofs,topofs,delay,disposal,previm);
^
GD.xs:1041:18: warning: implicit declaration of function 'gdImageGifAnimEndPtr' is invalid in C99 [-Wimplicit-function-declaration]
data = (void *) gdImageGifAnimEndPtr(&size);
^
GD.xs:1598:3: warning: implicit declaration of function 'gdImageOpenPolygon' is invalid in C99 [-Wimplicit-function-declaration]
gdImageOpenPolygon(image,polyptr,length,color);
^
GD.xs:2192:16: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (value = hv_fetch(hash,"linespacing",strlen("linespacing"),0)) {
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GD.xs:2192:16: note: place parentheses around the assignment to silence this warning
if (value = hv_fetch(hash,"linespacing",strlen("linespacing"),0)) {
^
( )
...
2 warnings generated.
rm -f blib/arch/auto/GD/GD.bundle
LD_RUN_PATH="/usr/lib:/usr/local/lib" clang -mmacosx-version-min=10.8 -arch i386 -arch x86_64 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector GD.o -o blib/arch/auto/GD/GD.bundle \
-L/usr/local/lib -lz -liconv -lgd \
ld: warning: ignoring file /usr/local/lib/libgd.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libgd.dylib
chmod 755 blib/arch/auto/GD/GD.bundle
/usr/bin/perl -MExtUtils::Command::MM -e 'cp_nonempty' -- GD.bs blib/arch/auto/GD/GD.bs 644
/usr/bin/perl "-Iblib/arch" "-Iblib/lib" bdf_scripts/bdf2gdfont.PLS bdf_scripts/bdf2gdfont.pl
Extracting bdf2gdfont.pl (with variable substitutions)
cp bdf_scripts/bdf2gdfont.pl blib/script/bdf2gdfont.pl
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/bdf2gdfont.pl
Manifying blib/man1/bdf2gdfont.pl.1
Manifying blib/man3/GD.3pm
Manifying blib/man3/GD::Image.3pm
Manifying blib/man3/GD::Polygon.3pm
Manifying blib/man3/GD::Polyline.3pm
Manifying blib/man3/GD::Simple.3pm
Running Mkbootstrap for GD ()
chmod 644 GD.bs
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Testing using gif support.
t/GD.t ........
Failed 6/12 subtests
(less 3 skipped subtests: 3 okay)
t/Polyline.t .. ok
Test Summary Report
-------------------
t/GD.t (Wstat: 0 Tests: 12 Failed: 6)
Failed tests: 2-7
Files=2, Tests=13, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.10 cusr 0.01 csys = 0.14 CPU)
Result: FAIL
Failed 1/2 test programs. 6/13 subtests failed.
make: *** [test_dynamic] Error 255
-> FAIL Installing GD failed. See /Users/lraven/.cpanm/work/1391048234.74068/build.log for details. Retry with --force to force install it.
Expiring 19 work directories.
All other modules I need are installing, just not GD.
I am using OS X 10.8.5, bash version 3.2.48, perl version 5.012 and cpanm version 1.7
回答1:
Before you can install GD the Perl module you must have installed a number of other libraries first, including the gd graphics library itself (libgd), the PNG library (libpng) and optionally the JPEG and FreeType libraries.
You will probably find it easier to use MacPorts to install these libraries, and you can then install GD from there too - the package is called p5.14-gd (or whatever matches your perl version)
回答2:
Following up on this - To get circos to work I did the following.... 1/ I installed all modules using cpanm
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
cpanm Config::General
cpanm Font::TTF
cpanm List::MoreUtils
cpanm Math::Bezier
cpanm Math::Round
cpanm Math::VecStat
cpanm Params::Validate
cpanm Readonly
cpanm Regexp::Common
cpanm Set::IntSpan
cpanm Text::Format
cpanm Clone
cpanm GD
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
GD would not install. To fix this: I Downloaded and installed macports from http://www.macports.org/install.php
sudo /opt/local/bin/port install gd2
sudo /opt/local/bin/port install jpeg
sudo /opt/local/bin/port install libpng
sudo /opt/local/bin/port install libgda5
I got an error associated with gnome desktop and ran
sudo /opt/local/bin/port clean gnome-desktop
then reinstalled libgd
Finally, to get GD to a spot where perl will find it…
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
来源:https://stackoverflow.com/questions/21444787/cannot-force-install-gd-with-cpan-cpanm