w3m build with CodeSourcery tool chain

Just another log of my try and error while building w3m for Angstrom Zaurus.

I found this post sometime ago and very interrested in CodeSourcery's tool chain.
motz diary: Compile Android kernel from the source

First of all, downlaod the toolchain tar ball. Make sure choice is ARM EABIGNU/Linux and IA32 GNU/Linux.
Download the ARM 2007q3 Release

Correction on Jan 18, 2008: A choice should be a pair of ARM GNU/Linux and IA32 GNU/Linux. We need -arm-none-linux-gnueabi-, not -arm-none-eabi-. Sorry for any inconvenience.

Then unpack it somewhere convenient for you. My case, /opt.
$ cd /opt
$ sudo tar jxvf arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
$ sudo ln -s arm-2007q3 arm-cc
$ export PATH=/opt/arm-cc/bin:$PATH
$ export CC=arm-none-linux-gnueabi-gcc
Download source code of w3m from SourceForge.

Try configure and build.
$ tar zxvf w3m-0.5.2.tar.gz
$ cd w3m-0.5.2
$ ./configure --host=arm-none-linux-gnueabi --enable-japanese=U
checking GC header location... /usr /usr/local ~/
checking /usr/include... checking gc.h usability... no
checking gc.h presence... no
checking for gc.h... no
So, w3m wants Hans_Boehm gc. After some googling, I found it in HP's site.
$ wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc.tar.gz
$ tar zxvf gc.tar.gz
$ cd gc6.7
$ ./configure --host=arm-none-linux-gnueabi --prefix=/opt/arm-cc
$ sudo make --dry-run install
$ sudo make install
arm-none-linux-gnueabi-ranlib /opt/arm-cc/lib/libgc.a
./libtool: line 4680: arm-none-linux-gnueabi-ranlib: command not found
Command is there and path is OK. So just edit the shell script to tell the absolute path to ranlib.

Edit libtool at line 172
Before: RANLIB="arm-none-linux-gnueabi-ranlib"
After:  RANLIB="/opt/arm-cc/bin/arm-none-linux-gnueabi-ranlib"

Try again.
$ sudo make install
Seems to be OK.

Go back to w3m build.
$ cd w3m-0.5.2
$ ./configure --host=arm-none-linux-gnueabi \
--prefix=/opt/arm-cc \
--with-gc=/opt/arm-cc \

checking whether setpgrp takes no argument...
configure: error: cannot check setpgrp when cross compiling
So, w3m really doesn't support cross compiling. Let's edit configure not to bail out on this error.

Comment out exit in configure at line 10501
# { (exit 1); exit 1; };

Try configure again, then make.
$ ./configure --host=arm-none-linux-gnueabi \
--prefix=/opt/arm-cc \
--with-gc=/opt/arm-cc \
$ make
etc.c: In function 'setup_child':
etc.c:1366: error: too many arguments to function 'setpgrp'
My setpgrp looks like void function. Edit configure again.

Add a following line to configure at line 10554

$ ./configure --host=arm-none-linux-gnueabi \
--prefix=/opt/arm-cc \
--with-gc=/opt/arm-cc \
$ make
./mktable 100 functable.tab > functable.c
/bin/bash: ./mktable: cannot execute binary file

$ file mktable
mktable: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), not stripped
Gee. Make try to build a tool runtime.

Edit Makefile to make x86 executable for mktable. It's kind a long story. So see w3m-0.5.2-arm-patch.tar.gz if you are interrested in.

$ make clean
$ make
Now I got tons of errors related ncurses is missing.
$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.4.tar.gz
$ tar zxvf ncurses-5.4.tar.gz
$ cd ncurses-5.4
$ ./configure --host=arm-none-linux-gnueabi --prefix=/opt/arm-cc
$ make
AWK=mawk sh ./tinfo/MKkeys_list.sh ../include/Caps | sort >keys.list
./make_keys keys.list > init_keytry.h
./make_keys: 1: Syntax error: word unexpected (expecting ")")
It looks like very tough thing to do.

Forget to build ncurses from scratch. Intead, copy them from openembedded image which I already have.
$ pushd ~/openembedded/tmp/work/armv5te-angstrom-linux-gnueabi/ncurses-5.4-r9/image/
$ cd usr/lib
$ cp -a . /opt/arm-cc/lib
$ cd ../share
$ cp -a . /opt/arm-cc/share
Or download ncurses-dev package on Angsrom Zaurus and copy them back.
$ ssh root@zaurus
# ipkg update
# ipkg install ncurses-dev
# ipkg files ncurses-dev
Package ncurses-dev (5.4-r10) is installed on root and has the following files:
... snip ...
Try again.
$ make clean
$ make
Looks good. Copy to Angsrom Zaurus and try.
$ tar zcvf /tmp/arm-w3m.tar.gz w3m w3mbookmark w3mhelperpanel w3mimgdisplay
$ pushd /opt/arm-cc/lib/gcc/arm-none-linux-gnueabi/4.2.1/
$ find . -name "libgc.*" -print | xargs tar zcvf /tmp/arm-libgc.tar.gz
$ scp /tmp/arm-w3m.tar.gz root@zaurus:/home/root
$ scp /tmp/arm-libgc.tar.gz root@zaurus:/home/root
$ ssh root@zaurus
# tar zxvf arm-w3m.tar.gz
# cd /usr/lib
# tar zxvf /home/root/arm-libgc.tar.gz
# LANG=c ./w3m http://hogehoge


posted by 安藤恐竜 at 20:08 | Comment(0) | TrackBack(0) | 日記
Comments for this entry
Leave your comment
Name: [Must]

EMail: [Must]

URL: [Must]

Comment: [Must]

Confirmation Code: [Must]

Type in alphabets what you see in this image.
Trackback URI:  http://blog.seesaa.jp/tb/78908606
Trackback entries must contain URL of this entry.

Trackbacks to this entry