鈍足ランナーのIT日記

走るのが好きな5流のITエンジニアのブログ。

趣味の範囲は広いけど、どれも中途半端なクソブロガー楽しめるWebアプリを作ってあっと言わせたい。サーバーサイドPerl(Mojolicious)、クライアントサイドVue.js。Arduinoにも触手を伸ばす予定。

PerlでXSLTに挑戦だぁー

まずはモジュールのインストール

cpanm XML::LibXSLT

libxmlt libxml2 が必要なようだった

The XSLT C library for GNOME

これらをチョイスするか

libxml2-2.9.0.tar.gz

libxslt-1.1.28.tar.gz

libxml2はmakeでこけた。それぞれ、バージョンを落とそう。

libxml2-2.7.2.tar.gz

libxslt-1.1.24.tar.gz

これらですと、make installまで難なくできた。 さて、cpanmだぁ。

cpanm XML::LibXSLT 
・・・・
/usr/bin/perl.exe /usr/lib/perl5/5.14/ExtUtils/xsubpp  -typemap /usr/lib/perl5/5.14/ExtUtils/typemap -typemap typemap  LibXSLT.xs > LibXSLT.xsc && mv LibXSLT.xsc LibXSLT.c
gcc-4 -c  -I/usr/local/include -I/usr/include   -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -g -fno-strict-aliasing -pipe -fstack-protector -DUSEIMPORTLIB -O3    -DVERSION=\"1.80\"  -DXS_VERSION=\"1.80\"  "-I/usr/lib/perl5/5.14/i686-cygwin-threads-64int/CORE"  -DHAVE_BLANK -DHAVE_BLANK -DHAVE_EXSLT LibXSLT.c
In file included from LibXSLT.xs:13:0:
/usr/local/include/libxslt/xslt.h:13:25: fatal error: libxml/tree.h: No such file or directory
コンパイルが中断されました。

/usr/include/libxml2/libxml/tree.hは存在するので うまく-I指定をしてやればいいようだが・・・どうすればいいのだろうか・・

とりあえず、Makefile.PLのINCに/usr/include/libxml2を追加して、

        $config{INC} = '-I/usr/local/include -I/usr/include/libxml2 -I/usr/include';

後は、手動で以下のように実行して回避しました。

perl Makefile.pl
make
make install

xsltprocコマンドで自宅の環境だと、コアダンプなんでだぁ。。。

$ xsltproc.exe -version
Using libxml 20702, libxslt 10124 and libexslt 813
xsltproc was compiled against libxml 20702, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20702
libexslt 813 was compiled against libxml 20702