H8_3069F/開発環境/クロスツールチェーンの構築 のバックアップの現在との差分(No.2)

Last-modified:

  • 追加された行はこの色です。
  • 削除された行はこの色です。
*クロスツールチェーンの構築 [#n39e957c]
**はじめに [#ade5dba1]
-Ubuntu12.04でH8300のツールチェーンを構築する
-Ubuntu12.04でH8300のクロスツールチェーンを構築したときのメモです
-gccの構築には色々なソースが必要で事前にそれらをビルドしておく必要があります
http://gcc.gnu.org/install/prerequisites.html
ここでは下記バージョンのソース(2013.4.20時点の最新版)を使用して構築しました
|ソフトウェア|バージョン|h
|binutils|2.23.2|
|gmp|5.1.1|
|mpfr|3.1.2|
|mpc|1.0|
|isl|0.11.1|
|cloog|0.18.0|
|gcc|4.8.0|

&ref(build.sh);

**事前準備 [#wac6be0c]
***m4のインストール [#v8116f46]
-ubuntの場合は事前にm4をインストールしておく必要がある
 sudo apt-get install m4

**手順 [#u82867ac]
***【STEP1】ソースの取得 [#b2e181bc]
 $ curl -O http://www.ring.gr.jp/archives/GNU/binutils/binutils-2.23.2.tar.bz2
 $ curl -O http://www.ring.gr.jp/archives/GNU/gcc/gcc-4.8.0/gcc-4.8.0.tar.bz2
 $ curl -O http://www.ring.gr.jp/archives/GNU/gmp/gmp-5.1.1.tar.bz2
 $ curl -O http://www.ring.gr.jp/archives/GNU/mpfr/mpfr-3.1.2.tar.bz2
 $ curl -O http://www.multiprecision.org/mpc/download/mpc-1.0.tar.gz
 $ curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.11.1.tar.bz2
 $ curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.0.tar.gz
**構築手順 [#u82867ac]
-下記スクリプトを実行することでクロスツールチェーン構築に必要なソースの取得およびビルドを一発で実行してくれます
make install時にsudoを使用しているので適宜パスワードを入力してください
 #!/bin/sh
 
 INSTALL_PREFIX=/usr/local/h8_cross_tools
 MAKE_OPT=-j4
 
 BINUTILS=binutils-2.23.2
 GMP=gmp-5.1.1
 MPFR=mpfr-3.1.2
 MPC=mpc-1.0
 ISL=isl-0.11.1
 CLOOG=cloog-0.18.0
 GCC=gcc-4.8.0
 
 BINUTILS_FILE=${BINUTILS}.tar.bz2
 GMP_FILE=${GMP}.tar.bz2
 MPFR_FILE=${MPFR}.tar.bz2
 MPC_FILE=${MPC}.tar.gz
 ISL_FILE=${ISL}.tar.bz2
 CLOOG_FILE=${CLOOG}.tar.gz
 GCC_FILE=${GCC}.tar.bz2
 
 GMP_INSTALL_PREFIX=${INSTALL_PREFIX}
 MPFR_INSTALL_PREFIX=${INSTALL_PREFIX}
 MPC_INSTALL_PREFIX=${INSTALL_PREFIX}
 ISL_INSTALL_PREFIX=${INSTALL_PREFIX}
 CLOOG_INSTALL_PREFIX=${INSTALL_PREFIX}
 #GMP_INSTALL_PREFIX=${INSTALL_PREFIX}/gmp
 #MPFR_INSTALL_PREFIX=${INSTALL_PREFIX}/mpfr
 #MPC_INSTALL_PREFIX=${INSTALL_PREFIX}/mpc
 #ISL_INSTALL_PREFIX=${INSTALL_PREFIX}/isl
 #CLOOG_INSTALL_PREFIX=${INSTALL_PREFIX}/cloog
 
 NEW_LD_LIBRARY_PATH=\
 ${GMP_INSTALL_PREFIX}/lib/:\
 ${MPFR_INSTALL_PREFIX}/lib/:\
 ${MPC_INSTALL_PREFIX}/lib/:\
 ${ISL_INSTALL_PREFIX}/lib/:\
 ${CLOOG_INSTALL_PREFIX}/lib/
 
 download_src() {
 	curl -O http://www.ring.gr.jp/archives/GNU/binutils/${BINUTILS_FILE}
 	curl -O http://www.ring.gr.jp/archives/GNU/gmp/${GMP_FILE}
 	curl -O http://www.ring.gr.jp/archives/GNU/mpfr/${MPFR_FILE}
 	curl -O http://www.multiprecision.org/mpc/download/${MPC_FILE}
 	curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/${ISL_FILE}
 	curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/${CLOOG_FILE}
 	curl -O http://www.ring.gr.jp/archives/GNU/gcc/${GCC}/${GCC_FILE}
 }
 
 build_src() {
 	echo "***************************************"
 	echo " - build ${BINUTILS} -"
 	echo "***************************************"
 	tar xjf ${BINUTILS_FILE}
 	cd ${BINUTILS}
 	./configure \
 	--target=h8300-elf \
 	--disable-nls \
 	--prefix=${INSTALL_PREFIX}
 	make ${MAKE_OPT}
 	sudo make install
 	cd ..
 	
 	echo "***************************************"
 	echo " - build ${GMP} -"
 	echo "***************************************"
 	tar xjf ${GMP_FILE}
 	cd ${GMP}
 	./configure \
 	--prefix=${GMP_INSTALL_PREFIX}
 	make ${MAKE_OPT}
 	make check ${MAKE_OPT}
 	sudo make install
 	cd ..
 	
 	echo "***************************************"
 	echo " - build ${MPFR} -"
 	echo "***************************************"
 	tar xjf ${MPFR_FILE}
 	cd ${MPFR}
 	./configure \
 	--prefix=${MPFR_INSTALL_PREFIX} \
 	--with-gmp=${GMP_INSTALL_PREFIX}
 	make ${MAKE_OPT}
 	make check ${MAKE_OPT}
 	sudo make install
 	cd ..
 	
 	echo "***************************************"
 	echo " - build ${MPC} -"
 	echo "***************************************"
 	tar xzf ${MPC_FILE}
 	cd ${MPC}
 	./configure \
 	--prefix=${MPC_INSTALL_PREFIX} \
 	--with-gmp=${GMP_INSTALL_PREFIX} \
 	--with-mpfr=${MPFR_INSTALL_PREFIX}
 	make ${MAKE_OPT}
 	make check ${MAKE_OPT}
 	sudo make install
 	cd ..
 	
 	echo "***************************************"
 	echo " - build ${ISL} -"
 	echo "***************************************"
 	tar xjf ${ISL_FILE}
 	cd ${ISL}
 	./configure \
 	--prefix=${ISL_INSTALL_PREFIX} \
 	--with-gmp-prefix=${GMP_INSTALL_PREFIX}
 	make ${MAKE_OPT}
 	sudo make install
 	cd ..
 	
 	echo "***************************************"
 	echo " - build ${CLOOG} -"
 	echo "***************************************"
 	tar xzf ${CLOOG_FILE}
 	cd ${CLOOG}
 	./configure \
 	--prefix=${CLOOG_INSTALL_PREFIX} \
 	--with-gmp-prefix=${GMP_INSTALL_PREFIX}
 	make ${MAKE_OPT}
 	sudo make install
 	cd ..
 	
 	echo "***************************************"
 	echo " - build ${GCC} -"
 	echo "***************************************"
 	tar xjf ${GCC_FILE}
 	cd ${GCC}
 	mkdir build
 	cd build/
 	export LD_LIBRARY_PATH=${NEW_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}
 	../configure \
 	--target=h8300-elf \
 	--disable-nls \
 	--disable-threads \
 	--disable-shared \
 	--disable-libssp \
 	--disable-isl-version-check \
 	--disable-cloog-version-check \
 	--enable-languages=c \
 	--with-gmp=${GMP_INSTALL_PREFIX} \
 	--with-mpfr=${MPFR_INSTALL_PREFIX} \
 	--with-mpc=${MPC_INSTALL_PREFIX} \
 	--with-isl=${ISL_INSTALL_PREFIX} \
 	--with-cloog=${CLOOG_INSTALL_PREFIX} \
 	--prefix=${INSTALL_PREFIX}/
 	make ${MAKE_OPT}
 	sudo make install
 }
 
 usage() {
 	echo "usage: build_h8300_env.sh [download|build]"
 }
 
 if [ $# -ge 1 ]; then
 	if [ "$1" = "download" ]; then
 		download_src
 	elif [ "$1" = "build" ]; then
 		build_src
 	else
 		usage
 	fi
 else
 	download_src
 	build_src
 fi

***【STEP2】binutilsのビルド [#gdca476a]
 $ tar xjf  binutils-2.23.2.tar.bz2
 $ cd binutils-2.23.2/
 $ ./configure \
 --target=h8300-elf \
 --disable-nls \
 --prefix=/usr/local/h8_cross_tools
 $ make -j4
 $ sudo make install
 $ cd ..

***【STEP3】gmpのビルド [#y5995ae0]
 $ tar xjf gmp-5.1.1.tar.bz2 
 $ cd gmp-5.1.1/
 $ ./configure \
 --prefix=/usr/local/h8_cross_tools/gmp
 $ make -j4
 $ make check -j4
 $ sudo make install
 $ cd ..

***【STEP4】mpfrのビルド [#zbf97009]
 $ tar xjf mpfr-3.1.2.tar.bz2
 $ cd mpfr-3.1.2/
 $ ./configure \
 --prefix=/usr/local/h8_cross_tools/mpfr \
 --with-gmp=/usr/local/h8_cross_tools/gmp
 $ make -j4
 $ make check -j4
 $ sudo make install
 $ cd ..

***【STEP5】mpcのビルド [#je662128]
 $ tar xzf mpc-1.0.tar.gz
 $ cd mpc-1.0/
 $ ./configure \
 --prefix=/usr/local/h8_cross_tools/mpc \
 --with-gmp=/usr/local/h8_cross_tools/gmp/ \
 --with-mpfr=/usr/local/h8_cross_tools/mpfr/
 $ make -j4
 $ make check -j4
 $ sudo make install
 $ cd ..

***【STEP6】islのビルド [#m3be737c]
 $ tar xjf isl-0.11.1.tar.bz2
 $ cd isl-0.11.1/
 $ ./configure \
 --prefix=/usr/local/h8_cross_tools/isl \
 --with-gmp-prefix=/usr/local/h8_cross_tools/gmp/
 $ make -j4
 $ sudo make install
 $ cd ..

***【STEP7】cloogのビルド [#o4d9ea63]
 $ tar xzf cloog-0.18.0.tar.gz
 $ cd cloog-0.18.0/
 $ ./configure \
 --prefix=/usr/local/h8_cross_tools/cloog \
 --with-gmp-prefix=/usr/local/h8_cross_tools/gmp/
 $ make -j4
 $ sudo make install
 $ cd ..

***【STEP8】gccのビルド [#c03cf4e1]
 $ tar xjf gcc-4.8.0.tar.bz2
 $ cd gcc-4.8.0/
 $ mkdir build
 $ cd build/
 $ 
 $ export LD_LIBRARY_PATH=/usr/local/h8_cross_tools/gmp/lib/\
 :/usr/local/h8_cross_tools/mpfr/lib/\
 :/usr/local/h8_cross_tools/mpc/lib/\
 :/usr/local/h8_cross_tools/isl/lib/\
 :/usr/local/h8_cross_tools/cloog/lib/\
 :$LD_LIBRARY_PATH
 $ 
 $ ../configure \
 --target=h8300-elf \
 --disable-nls \
 --disable-threads \
 --disable-shared \
 --disable-libssp \
 --disable-isl-version-check \
 --disable-cloog-version-check \
 --enable-languages=c \
 --with-gmp=/usr/local/h8_cross_tools/gmp/ \
 --with-mpfr=/usr/local/h8_cross_tools/mpfr/ \
 --with-mpc=/usr/local/h8_cross_tools/mpc/ \
 --with-isl=/usr/local/h8_cross_tools/isl/ \
 --with-cloog=/usr/local/h8_cross_tools/cloog/ \
 --prefix=/usr/local/h8_cross_tools/
 $ 
 $ make
 $ sudo make install