玄箱ProへGCC4.3.1をインストール

※下準備:gmp-4.2とmprf-2.3.1をインストールしておく。

現時点でのgccの最新版は4.3.1とのこと
とりあえずgcc-core-4.3.1.tar.gzを入手
あとは以下を参照
Installing GCC: Configuration
・・・英語読めない orz
とりあえず、ディレクトリを分けたほうが良さそう。
ソースを展開し、workdirを別に作成

/home/work/gcc/ # tar zvxf gcc-core-4.3.1.tar.gz
/home/work/gcc/ # mkdir workdir
/home/work/gcc/ # cd workdir/
/home/work/gcc/workdir # ../gcc-4.3.1/configure
/home/work/gcc/workdir # make

すると、

...
checking build system type... armv5tejl-unknown-linux-gnueabi
checking host system type... armv5tejl-unknown-linux-gnueabi
checking target system type... armv5tejl-unknown-linux-gnueabi
checking LIBRARY_PATH variable... contains current directory
configure: error:
*** LIBRARY_PATH shouldn't contain the current directory when
*** building gcc. Please change the environment variable
*** and run configure again.
make[2]: *** [configure-stage1-gcc] Error 1
make[2]: Leaving directory `/home/work/gcc/workdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/work/gcc/workdir'
make: *** [all] Error 2

ありゃ。LIBRARY_PATHってのがよろしくない?
unsetしてみる。

/home/work/gcc/workdir # unset LIBRARY_PATH
/home/work/gcc/workdir # make

今度は順調
・・・と思いきや。

...
In file included from ../../gcc-4.3.1/gcc/input.h:25,
                 from ../../gcc-4.3.1/gcc/tree.h:27,
                 from ../../gcc-4.3.1/gcc/c-lang.c:26:
../../gcc-4.3.1/gcc/../libcpp/include/line-map.h:63: error: `CHAR_BIT' undeclared here (not in a function)
../../gcc-4.3.1/gcc/../libcpp/include/line-map.h:63: error: bit-field `reason' width not an integer constant
../../gcc-4.3.1/gcc/../libcpp/include/line-map.h:63: warning: `reason' is narrower than values of its type
In file included from ../../gcc-4.3.1/gcc/c-common.h:25,
                 from ../../gcc-4.3.1/gcc/c-tree.h:24,
                 from ../../gcc-4.3.1/gcc/c-lang.c:27:
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:194: error: bit-field `type' width not an integer constant
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:194: warning: `type' is narrower than values of its type
In file included from ../../gcc-4.3.1/gcc/c-common.h:25,
                 from ../../gcc-4.3.1/gcc/c-tree.h:24,
                 from ../../gcc-4.3.1/gcc/c-lang.c:27:
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:237:3: #error "Cannot find a least-32-bit signed integer type"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:239: error: syntax error before "cppchar_t"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:239: warning: type defaults to `int' in declaration of `cppchar_t'
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:239: warning: data definition has no type or storage class
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:240: error: syntax error before "cppchar_signed_t"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:240: warning: type defaults to `int' in declaration of `cppchar_signed_t'
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:240: warning: data definition has no type or storage class
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:701: error: syntax error before "cpp_interpret_charconst"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:702: warning: type defaults to `int' in declaration of `cpp_interpret_charconst'
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:702: warning: data definition has no type or storage class
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:712: error: syntax error before "cpp_host_to_exec_charset"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:712: error: syntax error before "cppchar_t"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:712: warning: type defaults to `int' in declaration of `cpp_host_to_exec_charset'
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:712: warning: function declaration isn't a prototype
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:712: warning: data definition has no type or storage class
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:835: error: syntax error before "cpp_parse_escape"
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:836: warning: type defaults to `int' in declaration of `cpp_parse_escape'
../../gcc-4.3.1/gcc/../libcpp/include/cpplib.h:836: warning: data definition has no type or storage class
make[3]: *** [c-lang.o] Error 1
make[3]: Leaving directory `/home/work/gcc/workdir/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/work/gcc/workdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/work/gcc/workdir'
make: *** [all] Error 2

むむむ?
"CHAR_BIT"が宣言されていない?
よくわからないけど、line-map.hを勝手に書き換えて"limits.h"をincludeしてみる。

/home/work/gcc/workdir # cd ../gcc-4.3.1/libcpp/include/
/home/work/gcc/gcc-4.3.1/libcpp/include # cp line-map.h line-map.h.bk
/home/work/gcc/gcc-4.3.1/libcpp/include # vi line-map.h
(ごにょごにょ)
/home/work/gcc/gcc-4.3.1/libcpp/include # diff line-map.h line-map.h.bk
30,31d29
< #include <limits.h>
<
/home/work/gcc/gcc-4.3.1/libcpp/include # cd ../../../workdir/
/home/work/gcc/workdir # make

さっきよりは進んだ!
・・・が。

...
In file included from ../../gcc-4.3.1/gcc/c-lex.c:27:
../../gcc-4.3.1/gcc/real.h:57: error: `CHAR_BIT' undeclared here (not in a function)
In file included from ../../gcc-4.3.1/gcc/c-lex.c:27:
../../gcc-4.3.1/gcc/real.h:91:5: division by zero in #if
../../gcc-4.3.1/gcc/real.h:91:5: division by zero in #if
../../gcc-4.3.1/gcc/real.h:94:6: division by zero in #if
../../gcc-4.3.1/gcc/real.h:94:6: division by zero in #if
../../gcc-4.3.1/gcc/real.h:97:7: division by zero in #if
../../gcc-4.3.1/gcc/real.h:97:7: division by zero in #if
../../gcc-4.3.1/gcc/real.h:100:8: division by zero in #if
../../gcc-4.3.1/gcc/real.h:100:8: division by zero in #if
../../gcc-4.3.1/gcc/real.h:103:9: division by zero in #if
../../gcc-4.3.1/gcc/real.h:103:9: division by zero in #if
../../gcc-4.3.1/gcc/real.h:106:10: division by zero in #if
../../gcc-4.3.1/gcc/real.h:106:10: division by zero in #if
../../gcc-4.3.1/gcc/real.h:109:9: #error "REAL_WIDTH > 6 not supported"
make[3]: *** [c-lex.o] Error 1
make[3]: Leaving directory `/home/work/gcc/workdir/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/work/gcc/workdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/work/gcc/workdir'
make: *** [all] Error 2

また"CHAR_BIT"か・・・
懲りずに今度はreal.hを改変

/home/work/gcc/workdir # cd ../gcc-4.3.1/gcc/
/home/work/gcc/gcc-4.3.1/gcc # cp real.h real.h.bk
/home/work/gcc/gcc-4.3.1/gcc # vi real.h
(ごにょごにょ)
/home/work/gcc/gcc-4.3.1/gcc # diff real.h real.h.bk
30,31d29
< #include <limits.h>
<
/home/work/gcc/gcc-4.3.1/gcc # cd ../../workdir/
/home/work/gcc/workdir # make

さぁ、今度はどうだ・・・?

...
../../gcc-4.3.1/gcc/c-cppbuiltin.c: In function `c_cpp_builtins':
../../gcc-4.3.1/gcc/c-cppbuiltin.c:730: error: `ENABLE_DECIMAL_FLOAT' undeclared (first use in this function)
../../gcc-4.3.1/gcc/c-cppbuiltin.c:730: error: (Each undeclared identifier is reported only once
../../gcc-4.3.1/gcc/c-cppbuiltin.c:730: error: for each function it appears in.)
../../gcc-4.3.1/gcc/c-cppbuiltin.c:730: error: `ENABLE_DECIMAL_BID_FORMAT' undeclared (first use in this function)
make[3]: *** [c-cppbuiltin.o] Error 1
make[3]: Leaving directory `/home/work/gcc/workdir/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/work/gcc/workdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/work/gcc/workdir'
make: *** [all] Error 2

んんん・・・今度はまたちょっと違う。
調べてみると、"Installing GCC: Configuration"でconfigureのオプションに書いてあるっぽい。

--enable-decimal-float
--enable-decimal-float=yes
--enable-decimal-float=no
--enable-decimal-float=bid
--enable-decimal-float=dpd
--disable-decimal-float
Enable (or disable) support for the C decimal floating point extension that is in the IEEE 754-2008 standard. This is enabled by default only on PowerPC, i386, and x86_64 GNU/Linux systems. Other systems may also support it, but require the user to specifically enable it. You can optionally control which decimal floating point format is used (either `bid' or `dpd'). The `bid' (binary integer decimal) format is default on i386 and x86_64 systems, and the `dpd' (densely packed decimal) format is default on PowerPC systems.

よく分からないけど、玄箱ProはARMアーキテクチャだから、このへんはサポートされないってことなのかな。

/home/work/gcc/workdir # make distclean
/home/work/gcc/workdir # rm stage_final
/home/work/gcc/workdir # ../gcc-4.3.1/configure --enable-decimal-float=no
/home/work/gcc/workdir # make

とやってみたが、結局変わらずorz
どうすりゃいいんだろう〜


binutilsを新しいの入れたら変わるかな、と最新版をインストールしようとしてみたらmakeが失敗してtexinfoが必要なのかな?とtexinfoを入れようとしたら今度はconfigureがうまくいかなくてgawkやらbashやらを新しく入れてみたり。
なんだかどんどん遠ざかっている気がする。。。