I'm trying to get MobiPerl working so that I can convert some non-DRMed books in Mobi format to html so that I can touch them up and improve on the formatting done by the original creators (I'm picky and some free books aren't done well).
Alas, I'm running up against issues with getting the GD module in Perl working; I'm running Mac OS X Leopard 10.5.7 and I've installed seemingly everything needed to make it work, EXCEPT this module. I seem to be running up against an insurmountable bug.
I've installed X11, the X11 SDK, Fink, MacPorts, and I've followed the instructions in the MobiPerl page and on the MobieRead wiki. All attempts hang at making the GD module work. Here's what I see when trying to do the install using CPAN (I know it's long, but for completeness' sake ...)
Code:
cpan> install GD
CPAN: Storable loaded ok
Going to read /Users/buran/.cpan/Metadata
Database was generated on Sat, 21 Mar 2009 22:27:01 GMT
Running install for module GD
Running make for L/LD/LDS/GD-2.41.tar.gz
CPAN: Digest::MD5 loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for /Users/buran/.cpan/sources/authors/id/L/LD/LDS/GD-2.41.tar.gz ok
Scanning cache /Users/buran/.cpan/build for sizes
Deleting from cache: /Users/buran/.cpan/build/GD-2.41 (2.1>0.0 MB)
GD-2.41/
GD-2.41/t/
GD-2.41/t/test.out.3.jpeg
GD-2.41/t/GD.t
GD-2.41/t/tile.jpeg
GD-2.41/t/test.out.4.jpeg
GD-2.41/t/test.out.5.jpeg
GD-2.41/t/test.out.6.jpeg
GD-2.41/t/test.out.7.jpeg
GD-2.41/t/test.out.8.jpeg
GD-2.41/t/test.out.9.jpeg
GD-2.41/t/test.out.3.png-1
GD-2.41/t/Polyline.t
GD-2.41/t/test.out.4.png-1
GD-2.41/t/test.out.4.png-2
GD-2.41/t/test.out.10.png-1
GD-2.41/t/test.out.10.png-2
GD-2.41/t/test.out.10.png-3
GD-2.41/t/test.out.1.png
GD-2.41/t/test.out.2.gif
GD-2.41/t/test.out.2.png
GD-2.41/t/test.out.3.gif
GD-2.41/t/test.out.3.png
GD-2.41/t/test.out.4.gif
GD-2.41/t/test.out.4.png
GD-2.41/t/test.out.5.gif
GD-2.41/t/test.out.5.png
GD-2.41/t/test.out.6.gif
GD-2.41/t/test.out.6.png
GD-2.41/t/test.out.7.gif
GD-2.41/t/test.out.7.png
GD-2.41/t/test.out.8.gif
GD-2.41/t/test.out.8.png
GD-2.41/t/test.out.9.gif
GD-2.41/t/test.out.9.png
GD-2.41/t/test.out.5.png-1
GD-2.41/t/Generic.ttf
GD-2.41/t/test.out.6.png-1
GD-2.41/t/test.out.7.png-1
GD-2.41/t/frog.jpg
GD-2.41/t/frog.xpm
GD-2.41/t/test.out.10.jpeg
GD-2.41/t/test.out.8.png-1
GD-2.41/t/test.out.8.png-2
GD-2.41/t/test.out.8.png-3
GD-2.41/t/test.out.8.png-4
GD-2.41/t/test.out.8.png-5
GD-2.41/t/test.out.8.png-6
GD-2.41/t/tile.gif
GD-2.41/t/tile.png
GD-2.41/t/test.out.2.png-1
GD-2.41/t/test.out.9.png-1
GD-2.41/t/test.out.9.png-2
GD-2.41/t/palettemap.png
GD-2.41/t/test.out.10.gif
GD-2.41/t/test.out.10.png
GD-2.41/t/test.out.2.jpeg
GD-2.41/GD/
GD-2.41/GD/Group.pm
GD-2.41/GD/Polygon.pm
GD-2.41/GD/Simple.pm
GD-2.41/GD/Image.pm.PLS
GD-2.41/GD/Polyline.pm
GD-2.41/GD.pm
GD-2.41/GD.xs
GD-2.41/demos/
GD-2.41/demos/brushes.pl
GD-2.41/demos/font_list.png
GD-2.41/demos/fonttest
GD-2.41/demos/polys.pl
GD-2.41/demos/fills.pl
GD-2.41/demos/truetype_test
GD-2.41/demos/shapes.pl
GD-2.41/demos/copies.pl
GD-2.41/demos/ttf.pl
GD-2.41/demos/gd_example.cgi
GD-2.41/demos/tile.png
GD-2.41/demos/polyline.pl
GD-2.41/demos/transform.pl
GD-2.41/qd.pl
GD-2.41/README
GD-2.41/Makefile.PL
GD-2.41/README.QUICKDRAW
GD-2.41/META.yml
GD-2.41/typemap
GD-2.41/bdf_scripts/
GD-2.41/bdf_scripts/README
GD-2.41/bdf_scripts/bdf2gdfont.PLS
GD-2.41/bdf_scripts/bdftogd
GD-2.41/bdf_scripts/bdf2gdfont.pl
GD-2.41/README.unix
GD-2.41/ChangeLog
GD-2.41/MANIFEST
CPAN.pm: Going to build L/LD/LDS/GD-2.41.tar.gz
Configuring for libgd version 2.0.33.
Checking for stray libgd header files...none found.
Included Features: GD_XPM GD_JPEG GD_FONTCONFIG GD_FREETYPE GD_PNG GD_GIF GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33
GD library used from: /sw
Checking if your kit is complete...
Looks good
Writing Makefile for GD
/usr/bin/perl GD/Image.pm.PLS GD/Image.pm
Extracting Image.pm (with variable substitutions)
cp GD/Polyline.pm blib/lib/GD/Polyline.pm
cp qd.pl blib/lib/qd.pl
cp GD/Image.pm blib/lib/GD/Image.pm
cp GD.pm blib/lib/GD.pm
AutoSplitting blib/lib/GD.pm (blib/lib/auto/GD)
cp GD/Simple.pm blib/lib/GD/Simple.pm
cp GD/Polygon.pm blib/lib/GD/Polygon.pm
/usr/bin/perl /System/Library/Perl/5.8.8/ExtUtils/xsubpp -typemap /System/Library/Perl/5.8.8/ExtUtils/typemap -typemap typemap GD.xs > GD.xsc && mv GD.xsc GD.c
cc -c -I/sw/include -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include -O3 -DVERSION=\"2.41\" -DXS_VERSION=\"2.41\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" -DHAVE_JPEG -DHAVE_FT -DHAVE_XPM -DHAVE_GIF -DHAVE_PNG -DHAVE_ANIMGIF -DVERSION_33 -DHAVE_UNCLOSEDPOLY -DHAVE_FONTCONFIG -DHAVE_FTCIRCLE GD.c
Running Mkbootstrap for GD ()
chmod 644 GD.bs
rm -f blib/arch/auto/GD/GD.bundle
LD_RUN_PATH="/usr/X11/lib:/sw/lib:/usr/lib" cc -mmacosx-version-min=10.5.6 -arch i386 -arch ppc -bundle -undefined dynamic_lookup -L/usr/local/lib GD.o -o blib/arch/auto/GD/GD.bundle \
-L/usr/X11/lib -L/sw/lib -L/sw/lib -L/usr/X11/lib -L/sw/lib -lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng12 -lz -lgd \
ld warning: in /sw/lib/libjpeg.dylib, file is not of required architecture
ld warning: in /sw/lib/libgd.dylib, file is not of required architecture
chmod 755 blib/arch/auto/GD/GD.bundle
cp GD.bs blib/arch/auto/GD/GD.bs
chmod 644 blib/arch/auto/GD/GD.bs
/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::Polyline.3pm
Manifying blib/man3/GD::Image.3pm
Manifying blib/man3/GD::Simple.3pm
Manifying blib/man3/GD.3pm
Manifying blib/man3/GD::Polygon.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/GD..........Can't load './blib/arch/auto/GD/GD.bundle' for module GD: dlopen(./blib/arch/auto/GD/GD.bundle, 2): Library not loaded: /usr/X11/lib/libpng12.0.dylib
Referenced from: /sw/lib/libgd.2.dylib
Reason: Incompatible library version: libgd.2.dylib requires version 25.0.0 or later, but libpng12.0.dylib provides version 1.0.0 at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.
at t/GD.t line 14
Compilation failed in require at t/GD.t line 14.
BEGIN failed--compilation aborted at t/GD.t line 14.
t/GD..........dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-12
Failed 12/12 tests, 0.00% okay
t/Polyline....Can't load '/Users/buran/.cpan/build/GD-2.41/blib/arch/auto/GD/GD.bundle' for module GD: dlopen(/Users/buran/.cpan/build/GD-2.41/blib/arch/auto/GD/GD.bundle, 2): Library not loaded: /usr/X11/lib/libpng12.0.dylib
Referenced from: /sw/lib/libgd.2.dylib
Reason: Incompatible library version: libgd.2.dylib requires version 25.0.0 or later, but libpng12.0.dylib provides version 1.0.0 at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.
at /Users/buran/.cpan/build/GD-2.41/blib/lib/GD/Polyline.pm line 45
Compilation failed in require at /Users/buran/.cpan/build/GD-2.41/blib/lib/GD/Polyline.pm line 45.
BEGIN failed--compilation aborted at /Users/buran/.cpan/build/GD-2.41/blib/lib/GD/Polyline.pm line 45.
Compilation failed in require at t/Polyline.t line 10.
BEGIN failed--compilation aborted at t/Polyline.t line 10.
t/Polyline....dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/GD.t 2 512 12 23 191.67% 1-12
t/Polyline.t 2 512 1 2 200.00% 1
Failed 2/2 test scripts, 0.00% okay. 13/13 subtests failed, 0.00% okay.
make: *** [test_dynamic] Error 2
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force
cpan>
I've bolded what I believe is the problem, and I researched the problem and found the following:
Re: [Fink-users] libpng12.0.dylib not loaded
So I installed x11sdk.pkg from a 10.5.4 disk ... and tried again. Same result. Of course, if I try to run mobi2html anyway, it immediately tries to run with the ONE MODULE I can't seem to get working, and dies.
I have a Windows box, but I don't want to use that for this task. It's really inconvenient for me to do anything with it other than use it for games (long story, but true). Can't I get a precompiled GD.pm from anywhere that actually works? Fink and MacPorts can't seem to help me. (I did install gd2 via Fink, which isn't fixing this problem).
I can't be the only person in the world having this problem. There MUST be a solution!
Of course, gd seems to be fine in PHP ... as far as I can tell, anyway. But there's no such thing as MobiPHP, is there?
The MobiPerl site has precompiled binaries ... for Windows. No help.
And of course, Calibre works on this system but doesn't have a way to dump the text to HTML that I can tell... or does it?
Once I get the text into HTML I can rebuild them into new .prc files for my Kindle 2 (I've done this for a few books already that I had in HTML in the first place). The problem is getting the text out of the .prc file in the first place.
Honestly, I don't care about cover images in the first place as I can grab a cover image online anyway, for when I do make a new .prc ... if all we want is to dump the text to HTML, why do we need a graphics library? What about a Perl/PHP script that will ONLY save the text? I manually input the metadata I want when I reassemble the .prc after editing.