MCU

Windows PC の Cygwin に H8/SH 用の GCC-4.4.0 をインストールする。~


(1) GCC に必要なパッケージをビルド

binutils のインストール

binutils を先にインストールしておかないと、GCC のコンパイルで以下のエラーが出る。

checking for suffix of object files...
configure: error: in /home/hoge/work/gcc-4.4.0/objdir/h8300-elf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/hoge/work/gcc-4.4.0/objdir'
make: *** [all] Error 2

という訳で、インストールする。

$ tar zxvf binutils-2.19.tar.gz
$ cd binutils-2.19
$ mkdir objdir
$ cd objdir/

$ ../configure \
> --prefix=/usr/local/cross/h8 \
> --target=h8300-elf \
> --disable-nls \
> --with-newlib

$ make

GMP と MPFR のインストール

GCC の configureで、システムに GMP と MPFR の適当なバージョンがインストールされていないと、以下のメッセージが出るので必要なものをインストールする。

configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.
gmp を make

適当なフォルダで、以下を実行。

$ tar jvxf gmp-4.2.4.tar.bz2
$ cd gmp-4.2.4
$ ./configure --prefix=/usr/local/gmp-4.2.4 --build=i586
$ make
$ make check
$ make install
Libraries have been installed in:
   /usr/local/gmp-4.2.4/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
mpfr を Make

適当なフォルダで以下を実行する。

$ tar zvxf mpfr-2.4.1.tar.gz
$ cd mpfr-2.4.1
$ ./configure --prefix=/usr/local/mpfr-2.4.1 \
> --with-gmp-include=/usr/local/gmp-4.2.4/include \
> --with-gmp-lib=/usr/local/gmp-4.2.4/lib \
> --build=i586
$ make
$ make check
$ make install
Libraries have been installed in:
   /usr/local/mpfr-2.4.1/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

(2) GCC の Make

$ ../configure \
  --with-gmp=/usr/local/gmp-4.2.4 --with-mpfr=/usr/local/mpfr-2.4.1 \
  --disable-nls --enable-shared --enable-languages=c \
  --target=h8300-elf --prefix=/usr/local/cross/h8 \
  --with-newlib \
  --with-headers=/usr/src/rpm/SOURCES/h8-newlib-1.10.0/newlib/libc/include

$ make BOOT_LDFLAGS="-static"

うをっ!? エラーが出たよ。

/usr/local/cross/h8/h8300-elf/sys-include/machine/ieeefp.h:207:2:
error: #error Endianess not declared!!

ちょっと調べたのだが、英語のドキュメントばかりで、現時点では根本的な原因は分からない。
とりあえず、エンディアンがハッキリすれば良いのだろうから、強引に ieeefp.h を修正。
エラーは消えたが…、まぁ、ターゲットがハッキリしているので良いか?


(3) newlib の Make

$ cd h8-newlib-1.10.0
$ mkdir objdir
$ cd objdir
$ configure --target=h8300-elf --prefix=/usr/local/cross/h8

$ export PATH=/usr/local/cross/h8/bin:$PATH ← 新しいH8-GCCを使うのでパスを通す。

$ make
$ make install
最終更新のRSS
Last-modified: 2010-03-26 (金) 14:35:49 3158日前
HTML convert time: 0.015 sec.