coLinux上のクロスコンパイル環境
ザウルス用のクロスコンパイル環境をgcc3で構築。
参考サイト
binutilはapt-getで得たbinutil-2.15、gccは適当なサーバーからgcc-3.4.6を持ってくる。
参考サイトの手順をそのまま実践、環境構築後
$ export PATH=/usr/local/zaurus/bin:$PATH $ arm-linux-gcc hello.c -static-libgcc(コンパイル) $ file a.out(arm用になっているか確認) $ ldd a.out(←詳しく出ないので↓を行う) $ arm-linux-objdump -x a.out | grep NEEDED(使用ライブラリを確認)
- 以下、自分用手順メモ(参考サイトまるごとコピー)
binutil
(dpkg-sourceはdpke-devをインストールするとOK)
$ apt-get source binutils $ cd binutils-2.15 $ ./configure --prefix=/usr/local/zaurus \ --enable-shared --target=arm-linux --enable-targets=xscale-linux-elf $ make $ su # make install
ライブラリとヘッダーのコピー
各rpmファイルはザウルス宝箱proから入手。alienをインストール
$ alien --to-tgz glibc-arm-2.2.2-0.i386.rpm linux-headers-arm-sa1100-2.4.6-3.i386.rpm $ tar zxvf glibc-arm-2.2.2.tgz $ tar zxvf linux-headers-arm-sa1100-2.4.6.tgz $ su # cp -a ./opt/Embedix/tools/arm-linux/include /usr/local/zaurus/arm-linux # cp -a ./opt/Embedix/tools/arm-linux/lib /usr/local/zaurus/arm-linux
pthread.hとsigthread.hの修正
__thread → __threadpの修正を3ヶ所viで行った。
/usr/local/zaurus/arm-linux/include/pthread.h @@ -160,7 +160,7 @@ /* Create a thread with given attributes ATTR (or default attributes if ATTR is NULL), and call function START_ROUTINE with given arguments ARG. */ -extern int pthread_create (pthread_t *__restrict __thread, +extern int pthread_create (pthread_t *__restrict __threadp, __const pthread_attr_t *__restrict __attr, void *(*__start_routine) (void *), void *__restrict __arg) __THROW; @@ -583,7 +583,7 @@ extern int pthread_setcanceltype (int __type, int *__oldtype) __THROW; /* Cancel THREAD immediately or at the next possibility. */ -extern int pthread_cancel (pthread_t __thread) __THROW; +extern int pthread_cancel (pthread_t __threadp) __THROW; -------------------------------------------------------- /usr/local/zaurus/arm-linux/include/bits/sigthread.h @@ -33,6 +33,6 @@ __sigset_t *__restrict __oldmask)__THROW; /* Send signal SIGNO to the given thread. */ -extern int pthread_kill (pthread_t __thread, int __signo) __THROW; +extern int pthread_kill (pthread_t __threadp, int __signo) __THROW;
gccのコンパイル
$ export PATH=/usr/local/zaurus/bin:$PATH $ CFLAGS="-O2" CFLAGS_FOR_TARGET="-O2 -mcpu=xscale -Wa,-mfpu=fpa" \ ./configure --prefix=/usr/local/zaurus --target=arm-linux \ --with-cpu=xscale --enable-shared --enable-languages=c,c++ $ make $ su # export PATH=/usr/local/zaurus/bin:$PATH (必須) # make install