注意 †
パッケージ依存関係の破壊
ここで紹介するgcc-3.3パッケージは、debian.dodes.orgの環境(glibc-2.2.5)に、
そのままインストールできるよう、パッケージの依存関係を強引に修正してあります。
(本来、gcc-3.3パッケージはglibc-3.2.3上で動くことを前提としている。)
バックアップ重要
この依存関係の破壊がどのような副作用をもたらすか、筆者は十分把握していません。
従って、インストール前の状態に戻せるよう、
chrootのdebian環境丸ごとバックアップを取っておいて下さい。
gcc-3.3.4 †
- ヘッダファイルの修正
gcc-3.3では__threadという語が予約語扱いになったらしい。
従って一般変数名として__threadを使用している以下のヘッダファイルを修正する必要がある。
- /usr/include/bits/sigthread.h
- /usr/include/pthread.h
バックアップを取っておく。
landisk:~# cp /usr/include/bits/sigthread.h /usr/include/bits/sigthread.h_
landisk:~# cp /usr/include/pthread.h /usr/include/pthread.h_
landisk:~# perl -pi -e s'/__thread/__thread_param/' /usr/include/bits/sigthread.h
landisk:~# perl -pi -e s'/__thread/__thread_param/' /usr/include/pthread.h
参考:http://sources.redhat.com/ml/crossgcc/2003-05/msg00171.html
- binutils
landisk:~# dpkg -i binutils_2.14.90.0.7-8_sh4.deb binutils-dev_2.14.90.0.7-8_sh4.deb
- libgcc_s.so.1の退避(上書きされるので退避)
※これを行わないとg++-3.0が動作しなくなる。
landisk:~# cd /lib
landisk:/lib# mkdir libgcc_s
landisk:/lib# cp libgcc_s.so.1 libgcc_s/libgcc_s-3.0.4.so.1
landisk:/lib# ln -sf /lib/libgcc_s/libgcc_s-3.0.4.so.1 \
/usr/lib/gcc-lib/sh4-linux/3.0.4/libgcc_s.so
- インストール
landisk:~# dpkg -i gcc-3.3_3.3.4-7_sh4.deb cpp-3.3_3.3.4-7_sh4.deb \
gcc-3.3-base_3.3.4-7_sh4.deb libgcc1_3.3.4-7_sh4.deb
- 再度libgcc_s.so.1の退避
(別バージョンのgccをインストールて、上書きされてしまっても復旧できるようにあらかじめ退避しておく)
landisk:~# cd /lib
landisk:/lib# cp libgcc_s.so.1 libgcc_s/libgcc_s-3.3.4.so.1
landisk:/lib# ln -sf /lib/libgcc_s/libgcc_s-3.3.4.so.1 \
/usr/lib/gcc-lib/sh4-linux/3.3.4/libgcc_s.so
landisk:/lib# ln -sf /lib/libgcc_s/libgcc_s-3.3.4.so.1 libgcc_s.so.1
- テスト -- hello.c
#include<stdio.h>
#include<stdlib.h>
main()
{
printf("Hello world !!\n");
}
- コンパイルと実行
landisk:~# gcc-3.3 hello.c -o hello
landisk:~# ./hello
Hello world !!
- デフォルトコンパイラにするには
landisk:~# dpkg -i gcc_3.3.4-2_sh4.deb cpp_3.3.4-2_sh4.deb
landisk:~# gcc -v
Reading specs from /usr/lib/gcc-lib/sh4-linux/3.3.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,objc
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc sh4-linux
Thread model: posix
gcc version 3.3.4 (Debian 1:3.3.4-7)
g++ †
- インストール
landisk:~# dpkg -i g++-3.3_3.3.4-7_sh4.deb \
libstdc++5-3.3-dev_3.3.4-7_sh4.deb libstdc++5_3.3.4-7_sh4.deb
- テスト -- hello.cpp
#include <iostream>
main()
{
std::cout << "Hello C++ world !!\n";
}
- コンパイルと実行
landisk:~# g++-3.3 hello.cpp -o hello_cpp
landisk:~# ./hello_cpp
Hello C++ world !!
gcj (GNU Compiler for the Java) †
- テスト -- hello.java
public class hello {
public static void main(String[] argv) {
System.out.println("Hello Java World !!");
}
}
- コンパイルと実行
landisk:~# gcj-3.3 hello.java -o hello_java --main=hello
landisk:~# ./hello_java
Hello Java World !!
付録 … patch †
- debian/patches/sh-lib1funcs_sizeAndType.dpatch
libgcc内のsymbolをGLOBAL宣言するパッチ?。
"hidden symbol `__sdivsi3_i4' is referenced by DSO"対策?
- /debian/patches/sh-pic-set_fpscr-gcc-3.3.2.dpatch
FPU関連(FPUCR?)のパッチらしい?。
- debian/patches/sh4-build_3.3.4-7-fix.dpatch
- src/gcc/config/sh/t-linux
libgcc1パッケージ生成不備対策
- src/libffi/Makefile.in
java/jv-convert生成不備対策
原因はlibffi_convenience.aの生成不備
src/gcc/config/sh/libgcc-glibc.ver
"/lib/libgcc_s.so.1: version `GLIBC_2.0' not found"の対策
(こういう場当たり的な対策をしていいのだろうか!!)
src/gcc/config/sh/libgcc-std.ver
"hidden symbol `__sdivsi3_i4' is referenced by DSO"対策?
- debian/rules.conf
パッケージの依存関係を修正(glibc-2.2.5)
diff -ur OLD/debian/rules.conf NEW/debian/rules.conf
--- OLD/debian/rules.conf 2004-08-07 03:19:46.000000000 +0900
+++ NEW/debian/rules.conf 2004-08-07 09:00:00.000000000 +0900
@@ -24,7 +24,7 @@
# libc-dev dependencies
libc_ver := 2.2.5-8
-libc_ver := 2.3.1
+#libc_ver := 2.3.1
ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),alpha ia64))
LIBC_DEP = libc6.1-dev (>= $(libc_ver))
else
- debian/rules.patch
次のパッチの組み込み。
- sh-lib1funcs_sizeAndType.dpatch
- sh-pic-set_fpscr-gcc-3.3.2.dpatch
- sh4-build_3.3.4-7.dpatch
diff -ur OLD/debian/rules.patch NEW/debian/rules.patch
--- OLD/debian/rules.patch 2004-08-08 09:00:00.000000000 +0900
+++ NEW/debian/rules.patch 2004-08-08 12:13:22.000000000 +0900
@@ -126,6 +126,9 @@
# not applied by default
#debian_patches += protector
+debian_patches += sh-lib1funcs_sizeAndType
+debian_patches += sh-pic-set_fpscr-gcc-3.3.2
+debian_patches += sh4-build_3.3.4-7-fix
debian_patches += autoreconf # applied last
# debian/rules.conf isn't yet sourced
- debian/rules.defs
- gnat(Adaコンパイラ)
コンパイルできないので外した。
- libgcc
なぜかコメントアウトされている。
Intelアーキテクチャでは必要ないのか??
sh4をターゲットに含めた。
- check(testsuite)
ビルド時間短縮のため外した。
diff -ur OLD/debian/rules.defs NEW/debian/rules.defs
--- OLD/debian/rules.defs 2004-08-08 09:00:00.000000000 +0900
+++ NEW/debian/rules.defs 2004-08-08 12:19:16.000000000 +0900
@@ -372,7 +372,7 @@
endif
# Ada --------------------
-with_ada := yes
+with_ada := no
ifneq ($(with_dev),yes)
with_ada := no
endif
@@ -435,7 +435,7 @@
#ifeq ($(with_common_libs),yes)
# with_libgcc := yes
#else
- libgcc_archs := hppa m68k
+ libgcc_archs := hppa m68k sh sh3 sh4
ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(libgcc_archs)))
with_libgcc := yes
else
@@ -445,7 +445,7 @@
#endif
# run testsuite --------------------
-with_check := yes
+with_check := no
# If you don't want to run the gcc testsuite, set `with_check' to `no'
#with_check := disabled by hand
ifeq ($(with_base_only),yes)
付録 … 再ビルド †
gcc-3.3を使って、gcc-3.3パッケージを再ビルドする方法を記します。
- ビルド
ビルドも依存関係を解消すべくdpkg -i でひたすらパッケージをインストールします。
landisk:~/src/gcc-3.3-3.3.4 # dpkg-checkbuilddeps
dpkg-checkbuilddeps: Unmet build dependencies: libc6-dev (>= 2.3.1)
gnat-3.3 | gnat-3.2 doxygen (>= 1.3.6.20040222)
この状態までビルドの依存関係を解消できたなら、ビルドを行います。
landisk:~/src/gcc-3.3-3.3.4 # dpkg-buildpackage -uc -us -d 2>&1 | tee ../build.log
付録 … struct ustat の多重定義エラー †
- ustatの多重定義エラーが出た場合は、下記のパッチを適用すると良い。
glibc-2.3.2のビルド時に問題となった。(glibc-2.3.2は結局安定動作させられなかった)
diff -u /usr/include/linux/types.h_ /usr/include/linux/types.h
--- /usr/include/linux/types.h_ 2004-07-29 07:09:21.000000000 +0900
+++ /usr/include/linux/types.h 2004-07-29 07:11:20.000000000 +0900
@@ -115,6 +115,7 @@
#endif /* __KERNEL_STRICT_NAMES */
+#ifdef __KERNEL__
/*
* Below are truly Linux-specific types that should never collide with
* any application/library that wants linux/types.h.
@@ -126,5 +127,6 @@
char f_fname[6];
char f_fpack[6];
};
+#endif
#endif /* _LINUX_TYPES_H */
参考: http://www.kegel.com/crosstool/current/patches/linux-2.4.24/kaz-types.patch
Counter: 2472,
today: 1,
yesterday: 0