Emacs ファミリの中では nemacs に次いで cross build が難しい。 configure.in 曰く "XEmacs is unlikely to ever cross-compile" というだけあって、 configure が cross に全く対応していない。
というわけでメモ。
Jan 13, 2003 更新。ついでに 21.4.10 に。
% cd /home/src/emacs/xemacs % apt-get source xemacs21 % md xemacs21-i386 % md xemacs21-arm % cd xemacs21-i386 % ../xemacs21-21.4.10/configure --srcdir=/home/src/emacs/xemacs/xemacs21-21.4.10 \ --with-x11=no --with-menubars=no --with-scrollbars=no --with-dialogs=no \ --with-widgets=no --with-msw=no % make
% cd ../xemacs21-arm
% ../xemacs21-21.4.10/configure --srcdir=/home/src/emacs/xemacs/xemacs21-21.4.10 \
--with-mule --with-x11=no --with-menubars=no --with-scrollbars=no \
--with-dialogs=no --with-widgets=no --with-msw=no \
--with-database=no --without-ldap --without-gpm --prefix=/opt/QtPalmtop \
--without-canna --without-wnn --without-wnn6 arm-linux-gnu
もちろん native 環境にあって A300 にないものは意識的に除いておく。
このまま make すると arm-linux 向けの内部構造を持った native バイナリが出来る。 例によって crt*.o は差し替える。
% for name in `grep -l 'usr/lib/' **/*akefile` ; do
sed 's#/usr/lib/#/usr/local/Embedix/tools/arm-linux/lib/#g' < $name > ../makefile.tmp
mv ../makefile.tmp $name
done
書き換え先が "/opt/Embedix/ 〜" でなく "/usr/local/Embedix/ 〜" になっている。
手元の環境では symlink 張ってあるのでコンパイルにはどっちでも一緒なんだが、
ここで "/opt/Embedix/ 〜" は使わない
(後述; まあ fatal でもない話なんで、どーでもいいが)。
当初、CC も書き換えていたが、CC は書き換えない。こちらもかならず make 時に指定する。
% make CC=/usr/local/Embedix/tools/bin/arm-linux-gcc ... 中略 ... ./temacs -nd -batch -l /home/src/emacs/xemacs/xemacs21-21.4.10/src/../lisp/update-elc.el ./temacs: ./temacs: cannot execute binary file make[1]: *** [update-elc.stamp] Error 126 make[1]: Leaving directory `/home/src/emacs/xemacs/xemacs-arm/src' make: *** [src] エラー 2
もちろんそのままザウルス側で実行すると分離がたいへんなので chroot jail に降りる。
# mount -t nfs atropos:/home/src/SUBSYSTEM/arm /home/root/debian # cd /home/root/debian # chroot . /bin/zsh # mount -t proc proc /proc
続いて xemacs の tree を母艦と同じ位置におく。 crt*.o も A300 側から見える必要がある。 ここで "/opt/Embedix 〜" を使うようになっていると、 ザウルス側の /opt が read only になってたりしてハマるかもしれない (jail に降りれば一緒か ...)。
# mount -t nfs atropos:/home/src/emacs/xemacs /home/src/emacs/xemacs # mount -t nfs atropos:/usr/local/Embedix /usr/local/Embedix... 母艦側で tree を直接つないでおいたほうが パフォーマンス的に有利な気もしないでもない (^^;
ふつう母艦とザウルスで uid が違うはずだが、そのあたりは適当に調整するものとして。 ... つか、そこら中でひっかかってすげーうるさかったので 母艦の /etc/exports に臨時に禁断の no_root_squash 入れてしまった。make に入る:
# cd /home/src/emacs/xemacs/xemacs21-arm # strip src/temacs # make install母艦側でほとんどコンパイルをすましてしまっているにもかかわらず、10 分ちょいかかる。 また、CC の存在を確認しているので、 gcc を使わないにもかかわらず CC は gcc を指していなければならない (arm-linux-gcc を指していてはならない; てきとーにダミーのバイナリかなにかを置いておいてもいいんだが)。
それと emacs21 の時に書き忘れたが、emacs バイナリを strip するのは temacs の時点でおこなう。 dump した emacs バイナリを strip してはいけない ... 吸い上げて dump した *.elc も剥ぎ取られてしまうような感じ。
例によって母艦の native バイナリから。
% md mule-2.3-i386
% md mule-2.3-arm
% cd mule-2.3-19.34
% zcat mule-2.3-19.34-k1.diff.gz | patch -p1
% cd ../mule-2.3-i386
% ../mule-2.3-19.34/configure --with-terminal-face --with-mcpath \
--srcdir=/home/src/emacs/mule/mule-2.3-19.34
% make
つづいて arm バイナリ。
% ../mule-2.3-19.34/configure --build=i586-linux --host=arm-linux \
--srcdir=/home/src/emacs/mule/mule-2.3-19.34 --enable-terminal-face \
--with-mcpath --without-x --prefix=/home/QtPalmtop --without-canna
% make CC=/usr/local/Embedix/tools/bin/arm-linux-gcc
... いや、CC 指定なしでも arm-liux-gcc 使ってくれるんだけど。PATH 通してなかったから。
% cd /home/src/emacs % apt-get source emacs20-dl % fakeroot dpkg-buildpackage % ^C... すまん、まともな作り方が分からない ... ので、dpkg-buildpackage で make しかけてる途中で中断する。これで build-tree/emcas-20.7/ に本物のツリーが出来てくる。 これをソースとする。
% cd build-tree
% mv emacs-20.7 ../../
% cd ../..
% md emacs20-i386
% md emacs20-arm
% cd emacs20-i386
% ../emacs-20.7/configure --srcdir=/home/src/emacs/emacs-20.7 --with-x=no
% make
% cd ../emacs20-arm
% ../emacs-20.7/configure --srcdir=/home/src/emacs/emacs-20.7 --with-x=no \
--prefix=/opt/QtPalmtop --build=i686-linux --target=strongarm-linux arm-linux-gnu
以下は emacs21 のケースと同じ。略。
とりあえず、known bugs としては、
ので、mule, xemacs を追加。ところで、busybox の rm のバグで、 一つのディレクトリに大量のファイルがある場合、rm -rf が失敗することがある。 mule の .el の install で発覚したバグだが ... かつての emacs21 の install 失敗もこれに由来するんじゃあるまいな。
mule と xemacs 21.4.10 については、まだしばらく emmie にある予定。
... っても、直してるヒマあるんかなぁ ...