diff CbC-INSTALL @ 32:59194914942b

add documents. CbC-INSTALL: howto build the gcc for various systems. CbC-implementation.ja: methods of implementation for CbC's statement.
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Tue, 08 Dec 2009 14:07:28 +0900
parents cc07adb17855
children d645ac0f55d6
line wrap: on
line diff
--- a/CbC-INSTALL	Tue Dec 08 12:50:31 2009 +0900
+++ b/CbC-INSTALL	Tue Dec 08 14:07:28 2009 +0900
@@ -54,14 +54,14 @@
 
  * PS3でのビルド
  SPU
-../CbConGCC/configure --prefix=/usr/local/spu-cbc \
-  --build=powerpc --target=spu --program-prefix=spu- \
-  --disable-bootstrap --enable-checking=tree,rtl,assert \
-  --disable-nls --disable-shared --disable-threads \
-  --enable-languages=c --with-system-zlib --with-newlib \
-  --enable-version-specific-runtime-libs --disable-libssp \
-  --with-gnu-as -with-as=/usr/bin/spu-as --with-gnu-ld \
-  --with-ld=/usr/bin/spu-ld
+    ../CbConGCC/configure --prefix=/usr/local/spu-cbc \
+      --build=powerpc --target=spu --program-prefix=spu- \
+      --disable-bootstrap --enable-checking=tree,rtl,assert \
+      --disable-nls --disable-shared --disable-threads \
+      --enable-languages=c --with-system-zlib --with-newlib \
+      --enable-version-specific-runtime-libs --disable-libssp \
+      --with-gnu-as -with-as=/usr/bin/spu-as --with-gnu-ld \
+      --with-ld=/usr/bin/spu-ld
  PPU
   binutils
 	$ tar xzvf binutils-...tar.gz
@@ -120,6 +120,101 @@
 
 
 
+___________________________________________________________
+    PS3用のクロスコンパイラの作成
+-----------------------------------------------------------
+
+PS3でのGCCのビルドはメモリが少なすぎるためか、insn-*.cのコンパイルに膨
+大な時間がかかってしまう。
+なので別のマシンからPS3をターゲットとしたクロスコンパイラを作成する。
+ただしこれはCbConGCCの開発のためと考えた方が良い。実際にCbC言語を使っ
+たプログラムをPS3で開発する際はちゃんとPS3上にノンクロスコンパイラを作
+成しよう。時間はかかるがビルドは可能。
+
+ * 必要なもの
+  o binutilsのソース
+  o gccのソース
+  o ターゲットマシンのlib*.{a,so}類
+  o ターゲットマシンの.hファイル
+  ~/PS3CROSSにクロスコンパイラ環境を整えるとする
+  ~/PS3CROSS/cross-tools: クロスコンパイルに使うツールのインストール先
+  ~/PS3CROSS/sources: ソース置き場、出来上がったら消してもいいよ
+  ~/PS3CROSS/target-env: ターゲット環境(libやinclude)が入ったディレクトリ
+
+ * 準備
+  $ CROSS=$HOME/PS3CROSS
+  $ cd $CROSS
+  $ mkdir sources cross-tools target-env
+  $ cd sources
+  $ wget ...  binutilsとかgccのソースをダウンロード
+
+ * binutilsのビルド
+  $ tar xvf binutils..tar.gz
+  $ mkdir PS3-binutils-build; cd !#1
+  $ ../binutils-.../configure --prefix=$CROSS/cross-tools \
+    --with-lib-path=$CROSS/target-env \
+    --hosti686-pc-linux-gnu --build=i686-pc-linux-gnu \
+    --target=ppc64-redhat-linux --enable-64-bit-bfd \
+    --disable-nls --enable-shared --with-sysroot
+  $ make && make install
+
+ * ターゲットマシンの環境をコピーする
+  $ cd $CROSS/target-env
+  $ mkdir include lib lib64
+  $ ln -s . usr
+  ## 必要なライブラリはすべてコピー
+  $ cd lib
+  $ rsync -avl 'charles.cr:/lib/libc[.-_]*' ./
+  $ rsync -avl 'charles.cr:/usr/lib/libc[.-_]*' ./
+  $ rsync -avl 'charles.cr:/usr/lib/crt*' ./
+  $ rsync -avl 'charles.cr:/lib/ld*' ./
+  $ cd ../lib64
+  $ .....
+  ## ヘッダは軽いので全部コピー
+  $ cd ../include
+  $ rsync -avl 'charles.cr:/usr/include/*' ./
+
+ * GCCのビルド
+  $ cd $CROSS/sources
+  $ mkdir PS3-gcc-build; cd !#1
+  $ ../.../configure --prefix=$CROSS/cross-tools
+    --host=i686-pc-linux-gnu --target=ppc64-redhat-linux
+    --with-sysroot=$CROSS/target-env --disable-nls
+    --disable-shared --disable-threads
+    --enable-languages=c --without-headers
+    --disable-bootstrap
+  $ make all-gcc
+  $ make   ## エラーで終わるけど気にするな
+  $ make install-gcc
+  $ make install-target-libgcc
+
+ * テスト
+  $ cat >test.c <<EOF
+  	#include<stdio.h>
+  	int
+  	main(int argc, char **argv)
+  	{
+  		int a=0;
+  		int i;
+  		for (i=0; i<10; i++) {
+  			a = i;
+  		}
+  		printf("hello world\n");
+  		printf("a = %d\n", a);
+  		return a;
+  	}
+  EOF
+  $ $CROSS/cross-tools/bin/gcc -m32 test.c -o test32
+  $ $CROSS/cross-tools/bin/gcc -m64 test.c -o test64
+  $ file test32 test64
+  test32: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
+  test64: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
+  $ scp test{32,64} PS3Machine:
+  PS3Machine $ ./test32
 
 
 
+
+
+
+