Mac OS X で HTML::Tidy 再び

MacOS X には HTML::Tidy はインストールできないのか で HTML::Tidy のインストールに失敗すると書いた。先日、delphinus35 さんから、MacPorts を利用して Tidy をインストールされる際に生成される libtidy.a を使えば、HTML::Tidy をインストールできると書かれたので試してみた。

最初に結論

最初に結論を書いてしまうが、やはりテストで失敗をしてしまい、HTML::Tidy のインストールはできなかった。

  • Tidy はすでに MacPorts で インストール済
  • ranlib で参照する libtidy.a を変更しても、テストで失敗する
  • local::lib をインストールして $HOME ディレクトリに CPAN 環境を構築している

ということもあり、もしかしたら自分の環境のみでエラーが発生するのかもしれない。

2010-03-09 追記

テストで出力されるエラーで調べたところ、HTML::Tidy 1.08 において、Tidy.xs が libtidy のバッファを正しく初期化しないバグが原因らしい。

残念なことに、C言語Perl の XS がわからないために、これ以上、追求しようがない…。

実行した内容

まずは tidy の存在を確認する。
I recieved a comment that said it seemd possible to install HTML::Tidy if Tidy was installed with MacPorts and the libtidy was specified at "/opt/local/lib/libtidy.a" with ranlib. (but, at last I couldn't install HTML::Tidy. I thought it might be caused that I installed local::lib. See at It looks like Tidy.xs does not initializes libtidy's buffers correctly)

% tidy -v
HTML Tidy for Mac OS X released on 25 March 2009
% which tidy
/opt/local/bin/tidy
% ls -l /opt/local/lib/ | grep libtidy
-rwxr-xr-x   2 root  admin   355624  2 24 21:47 libtidy-0.99.0.dylib
-rw-r--r--   1 root  admin   530160  3  8 19:39 libtidy.a
lrwxr-xr-x   1 root  admin       20  2 24 21:47 libtidy.dylib -> libtidy-0.99.0.dylib
-rwxr-xr-x   2 root  admin      940  2 24 21:47 libtidy.la

HTML::Tidy をインストールしてみる

% sudo ranlib /opt/local/lib/libtidy.a 
Password:
% cpan -i P/PE/PETDANCE/HTML-Tidy-1.08.tar.gz
...
Failed 15/20 test scripts. 26/75 subtests failed.
Files=20, Tests=75,  1 wallclock secs ( 0.59 cusr +  0.19 csys =  0.78 CPU)
Failed 15/20 test programs. 26/75 subtests failed.
make: *** [test_dynamic] Error 255
  PETDANCE/HTML-Tidy-1.08.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports PETDANCE/HTML-Tidy-1.08.tar.gz
Running make install
  make test had returned bad status, won't install without force

ふうむ…。

tidy を再インストールして HTML::Tidy のインストールを試してみる

Uninstalled tidy, reinstal tidy with MacPorts and then try to install HTML::Tidy again.

% sudo port uninstall tidy
--->  Deactivating tidy @20090325_0
--->  Uninstalling tidy @20090325_0

tidy 再インストール前に、ranlib のパスを設定しておく。(set tha path to ranlib.)

% export set RANLIB=ranlib

tidy のインストール後に、HTML::Tidy のインストールを試みる。

% sudo port install tidy
--->  Computing dependencies for tidy
--->  Fetching tidy
--->  Verifying checksum(s) for tidy
--->  Extracting tidy
--->  Configuring tidy
--->  Building tidy
--->  Staging tidy into destroot
--->  Installing tidy @20090325_0
--->  Activating tidy @20090325_0
--->  Cleaning tidy
% sudo ranlib /opt/local/lib/libtidy.a       
% cpan -i P/PE/PETDANCE/HTML-Tidy-1.08.tar.gz
...
t/wordwrap...........dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 2
	Failed 1/2 tests, 50.00% okay
Failed Test         Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/cfg-for-parse.t      0    11     3    2  3
t/clean-crash.t        0    11     3    2  3
t/extra-quote.t        0    11     4    4  3-4
t/ignore-text.t        0    11     3    2  3
t/ignore.t             0    11     7   10  3-7
t/levels.t             0    11     3    2  3
t/opt-00.t             0    11     2    2  2
t/perfect.t            0    11     3    2  3
t/roundtrip.t          0    11     4    4  3-4
t/segfault-form.t      0    11     3    4  2-3
t/simple.t             0    11     4    4  3-4
t/too-many-titles.t    0    11     3    2  3
t/unicode.t            0    11     7    8  4-7
t/venus.t              0    11     3    2  3
t/wordwrap.t           0    11     2    2  2
2 tests skipped.
Failed 15/20 test scripts. 26/75 subtests failed.
Files=20, Tests=75,  2 wallclock secs ( 0.59 cusr +  0.19 csys =  0.78 CPU)
Failed 15/20 test programs. 26/75 subtests failed.
make: *** [test_dynamic] Error 255
  PETDANCE/HTML-Tidy-1.08.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports PETDANCE/HTML-Tidy-1.08.tar.gz
Running make install
  make test had returned bad status, won't install without force

この時点で、lib::local を利用しているからでは…と思い始める。念のため、sudo で HTML::Tidy をインストールしてみるが、結果は変わらず。

% sudo cpan -i P/PE/PETDANCE/HTML-Tidy-1.08.tar.gz
...
  CPAN.pm: Going to build P/PE/PETDANCE/HTML-Tidy-1.08.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for HTML::Tidy
cp lib/HTML/Tidy/Message.pm blib/lib/HTML/Tidy/Message.pm
cp lib/HTML/Tidy.pm blib/lib/HTML/Tidy.pm
/opt/local/bin/perl /opt/local/lib/perl5/vendor_perl/5.8.9/ExtUtils/xsubpp  -typemap /opt/local/lib/perl5/5.8.9/ExtUtils/typemap  Tidy.xs > Tidy.xsc && mv Tidy.xsc Tidy.c
/usr/bin/gcc-4.2 -c  -I. -I/usr/include/tidy -I/usr/local/include/tidy -I/sw/include/tidy -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -pipe -I/opt/local/include -O3   -DVERSION=\"1.08\" -DXS_VERSION=\"1.08\"  "-I/opt/local/lib/perl5/5.8.9/darwin-2level/CORE"   Tidy.c
In file included from /usr/include/tidy/tidy.h:70,
                 from Tidy.xs:5:
/usr/include/tidy/platform.h:107:1: warning: "HAS_VSNPRINTF" redefined
In file included from /opt/local/lib/perl5/5.8.9/darwin-2level/CORE/perl.h:38,
                 from Tidy.xs:2:
/opt/local/lib/perl5/5.8.9/darwin-2level/CORE/config.h:3783:1: warning: this is the location of the previous definition
Running Mkbootstrap for HTML::Tidy ()
chmod 644 Tidy.bs
rm -f blib/arch/auto/HTML/Tidy/Tidy.bundle
LD_RUN_PATH="/opt/local/lib" env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/gcc-4.2  -L/opt/local/lib -bundle -undefined dynamic_lookup Tidy.o  -o blib/arch/auto/HTML/Tidy/Tidy.bundle 	\
	   -ltidy  	\
	  
chmod 755 blib/arch/auto/HTML/Tidy/Tidy.bundle
cp Tidy.bs blib/arch/auto/HTML/Tidy/Tidy.bs
chmod 644 blib/arch/auto/HTML/Tidy/Tidy.bs
cp bin/webtidy blib/script/webtidy
/opt/local/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/webtidy
Manifying blib/man3/HTML::Tidy::Message.3pm
Manifying blib/man3/HTML::Tidy.3pm
  PETDANCE/HTML-Tidy-1.08.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /opt/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load............ok                                                      
t/cfg-for-parse......dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/clean-crash........dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/extra-quote........dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 3-4
	Failed 2/4 tests, 50.00% okay
t/ignore-text........dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/ignore.............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 3-7
	Failed 5/7 tests, 28.57% okay
t/levels.............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/message............ok                                                      
t/opt-00.............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 2
	Failed 1/2 tests, 50.00% okay
t/perfect............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/pod-coverage.......skipped
        all skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
t/pod................skipped
        all skipped: Test::Pod 1.14 required for testing POD
t/roundtrip..........dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 3-4
	Failed 2/4 tests, 50.00% okay
t/segfault-form......dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 2-3
	Failed 2/3 tests, 33.33% okay
t/simple.............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 3-4
	Failed 2/4 tests, 50.00% okay
t/too-many-titles....dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/unicode............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 4-7
	Failed 4/7 tests, 42.86% okay
t/venus..............dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
	Failed 1/3 tests, 66.67% okay
t/version............ok                                                      
t/wordwrap...........dubious                                                 
	Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 2
	Failed 1/2 tests, 50.00% okay
Failed Test         Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/cfg-for-parse.t      0    11     3    2  3
t/clean-crash.t        0    11     3    2  3
t/extra-quote.t        0    11     4    4  3-4
t/ignore-text.t        0    11     3    2  3
t/ignore.t             0    11     7   10  3-7
t/levels.t             0    11     3    2  3
t/opt-00.t             0    11     2    2  2
t/perfect.t            0    11     3    2  3
t/roundtrip.t          0    11     4    4  3-4
t/segfault-form.t      0    11     3    4  2-3
t/simple.t             0    11     4    4  3-4
t/too-many-titles.t    0    11     3    2  3
t/unicode.t            0    11     7    8  4-7
t/venus.t              0    11     3    2  3
t/wordwrap.t           0    11     2    2  2
2 tests skipped.
Failed 15/20 test scripts. 26/75 subtests failed.
Files=20, Tests=75,  1 wallclock secs ( 0.59 cusr +  0.19 csys =  0.78 CPU)
Failed 15/20 test programs. 26/75 subtests failed.
make: *** [test_dynamic] Error 255
  PETDANCE/HTML-Tidy-1.08.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports PETDANCE/HTML-Tidy-1.08.tar.gz
Running make install
  make test had returned bad status, won't install without force

試していないこと(Not try to do followings yet.)

  • root からの HTML::Tidy インストール(Not try to install HTML::Tidy as root user yet, for avoiding being affected on local::lib.)
  • local::lib を利用していない環境下でのインストール(Not try to install HTML::Tidy without local::lib yet.)

もし、上記でどれかを試してみたら、インストールができるかもしれない。