FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

Interfaceのコンパイラ入門のビルドをやってみた(ARM: 成功編)

Interface (インターフェース) 2015年 03月号

Interface (インターフェース) 2015年 03月号

前回、コンパイルできなかったのはBinutilsGCCのインストール位置が違っていたからだった。情けない。。。 という訳で、再度コンパイルし直し。newlibのインストールまでうまくいった。 が、2回目のGCCコンパイル時に何か良く分からないことを言われた。

configure: error: No support for this host/target combination.

あれ、良く見ると --with-newlib がオプションとして追加されている。 --enable-language="c c++" のところには下線が引いてあるのに、こっちには引いていないので気がつかなかった。。。 --with-newlib を追加するとうまくいった。

../binutils-2.24/configure --target arm-eabi --disable-nls --enable-gold --prefix=/home/masayuki/gcc_arm
make
make install
  • GCCのインストール(1回目)
../gcc-4.9.2/configure --prefix=/home/masayuki/gcc_arm/ --target=arm-eabi --disable-nls --disable-libssp --with-gnu-ld --with-gnu-as --disable-shared --enable-languages=c
make
make install
  • newlibのインストール
../newlib-2.1.0/configure --target=arm-eabi --prefix=/home/masayuki/gcc_arm/
make
# arm-eabi/libgloss/arm/cpu-init/Makefile の修正
# arm-eabi/fpu/libgloss/arm/cpu-init/Makefile の修正
# arm-eabi/thumb/libgloss/arm/cpu-init/Makefile の修正
make
make install
  • GCCのインストール(2回目)
../gcc-4.9.2/configure --prefix=/home/masayuki/gcc_arm/ --target=arm-eabi --disable-nls --disable-libssp --with-gnu-ld --with-gnu-as --disable-shared --enable-languages="c c++" --with-newlib
make
make install

newlibのところがミソなんだな。一度makeするとコンパイルに必ず失敗する。するとビルドディレクトリにMakefileが生成されているので、それを修正して再コンパイル、って訳だ。やっと分かった。 ちなみに、同時平行でMIPSコンパイルしてみたが、こちらはnewlibの変更は必要なかった。使っているファイルが違うのかな。