ルギア君の戯言

雑多な記事。

TeX Live 2014 - その 1

時間があるときに少しずつ TeX Live のパッケージし直し作業をしていて、とりあえず 2013 で調整していたが、昨日見たら 5/25 に 2014 がリリースされていたので、2014 へ移行することにした。TeX wiki を見るといくつか不具合が上がっていたりしているみたいなので、2014 にしたほうがよさそう。

2013 は特別問題なくビルドはできていたので、2014 も問題ないだろうと思っていたら、そんなことはなかった。

ビルド

見やすいようにバックスラッシュと改行を追加した。

+ ./configure --build=x86_64-unknown-linux-gnu \
              --host=x86_64-unknown-linux-gnu \
              --target=x86_64-momonga-linux \
              --program-prefix= \
              --prefix=/usr \
              --exec-prefix=/usr \
              --bindir=/usr/bin \
              --sbindir=/usr/sbin \
              --sysconfdir=/etc \
              --datadir=/usr/share \
              --includedir=/usr/include \
              --libdir=/usr/lib64 \
              --libexecdir=/usr/libexec \
              --localstatedir=/var \
              --sharedstatedir=/usr/com \
              --mandir=/usr/share/man \
              --infodir=/usr/share/info \
             '--with-banner-add=built for Momonga Linux' \
              --disable-native-texlive-build \
              --enable-tex-synctex \
              --enable-etex \
              --enable-shared \
              --enable-xindy \
              --disable-xindy-docs \
              --with-system-gd \
              --with-system-libpng \
              --with-system-cairo \
              --with-system-t1lib \
              --with-system-libgs \
              --with-system-icu \
              --with-system-zziplib \
              --with-system-freetype2 \
              --with-system-teckit \
              --with-system-harfbuzz \
              --with-system-xpdf \
              --with-system-zlib \
              --with-system-poppler \
              --with-system-pixman \
              --with-system-potrace \
              --with-system-libpaper \
              --with-xdvi-x-toolkit=motif \
              --with-x \
              --with-clisp-runtime=system

(中略)

checking for x86_64-unknown-linux-gnu-freetype-config... no
checking for freetype-config... freetype-config
checking kpathsea/version.h usability... yes
checking kpathsea/version.h presence... yes
checking for kpathsea/version.h... yes
configure: error: Sorry, you need libpng
=== configuring in dvipdfm-x failed
make[2]: *** [recurse] Error 1
make[2]: Leaving directory  `/home/lunastra/Momonga/pkgs/texlive/BUILD/texlive-2014/build/texk'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lunastra/Momonga/pkgs/texlive/BUILD/texlive-2014/build/texk'
make: *** [all-recursive] Error 1
エラー: /var/tmp/rpm-tmp.v1wjij の不正な終了ステータス (%build)

ん?

configure: error: Sorry, you need libpng

入ってないわけなかろう。

> rpm -q libpng-devel
libpng-devel-1.2.51-1m.mo8.x86_64

原因調査

> less texlive-20140525-source/texk/dvipdfm-x/configure.ac

....

KPSE_ADD_FLAGS([libpng])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]],
                                [[png_const_structp png; png_const_infop info; int err;
                                  err=png_get_image_width(png, info);]])],
               [],
               [AC_MSG_ERROR([Sorry, you need libpng])])

ふむ。ログは、と。

libtool: link: gcc -o .libs/conftest -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -m64 -mtune=generic -fPIC -I/usr/include/libpng12 -I/home/lunastra/Momonga/pkgs/texlive/BUILD/texlive-2014/build/texk -I/home/lunastra/Momonga/pkgs/texlive/BUILD/texlive-2014/texlive-20140525-source/texk conftest.c  -lpng12 -lz /home/lunastra/Momonga/pkgs/texlive/BUILD/texlive-2014/build/texk/kpathsea/.libs/libkpathsea.so -lm -Wl,-rpath -Wl,/usr/lib64
conftest.c: In function 'main':
conftest.c:68:1: error: unknown type name 'png_const_structp'
conftest.c:68:24: error: unknown type name 'png_const_infop'
conftest.c:69:35: warning: passing argument 1 of 'png_get_image_width' makes pointer from integer without a cast [enabled by default]
/usr/include/libpng12/png.h:2293:8: note: expected 'png_structp' but argument is of type 'int'
conftest.c:69:35: warning: passing argument 2 of 'png_get_image_width' makes pointer from integer without a cast [enabled by default]
/usr/include/libpng12/png.h:2293:8: note: expected 'png_infop' but argument is of type 'int'

ChangeLog も見るか。

2014-01-02  Peter Breitenlohner  <peb@...>

        * pngimage.c: Allow libpng >= 1.6.3 to read images with
        incorrect CMF bytes.

なるほど。新しいバージョンの libpng が必要なわけですな。

なのだが、

> pwd
/home/lunastra/Momonga/pkgs/texlive/BUILD/texlive-2014/texlive-20140525-source/texk/dvipdfm-x
> grep -R png\\.h *
README:     http://www.libpng.org/pub/png/libpng.html
configure:$(LIBPNG_DEPEND): ${top_builddir}/../../libs/libpng/include/png.h
configure:${top_builddir}/../../libs/libpng/include/png.h:
configure:#include <png.h>
configure.ac:AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]],
pngimage.c:#include <png.h>
> gcc -c pngimage.c 
>

バージョンチェックに使っているのみでコンパイル自体は通りそう。というわけでパッチを作成。

--- texlive-20140525-source/texk/dvipdfm-x/configure.orig       2014-03-18 01:24:19.000000000 +0900
+++ texlive-20140525-source/texk/dvipdfm-x/configure    2014-06-22 18:03:46.857922497 +0900
@@ -15715,7 +15715,7 @@
 int
 main ()
 {
-png_const_structp png; png_const_infop info; int err;
+png_structp png; png_infop info; int err;
                                   err=png_get_image_width(png, info);
   ;
   return 0;

まあ、どうせ libpng のバージョンは上げるらしいから一時的なものということで。

RPM ビルドエラー:
    インストール済み(ただし未伸張)ファイルが見つかりました:
   /usr/bin/a2ping
   /usr/bin/a5toa4
   /usr/bin/adhocfilelist
   /usr/bin/afm2afm
   /usr/bin/afm2pl
   /usr/bin/afm2tfm
   /usr/bin/aleph
   /usr/bin/allcm
   /usr/bin/allec
   /usr/bin/allneeded
   /usr/bin/arara
   /usr/bin/arlatex
(以下略)

おお、ビルド通った。

ちなみに、harfbuzz には graphite2 関係のヘッダファイルが(修正済)、potrace にはライブラリがごっそり抜けているが texlive をビルドする際に必要なので、texlive を上げるときに(有効になっていなければ)一緒に有効にしたいと思います。

バンドルされている libpng じゃダメなのかっていう話も多分あるだろうけど、システムにインストールされているのを使うライブラリとバンドルを使うライブラリのライブラリの組み合わせによってだと思うが、なんかうまく行かなかった。

とりあえず、終わり。次はいつだろう。