comparison 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
comparison
equal deleted inserted replaced
31:79124facde7c 32:59194914942b
52 52
53 53
54 54
55 * PS3でのビルド 55 * PS3でのビルド
56 SPU 56 SPU
57 ../CbConGCC/configure --prefix=/usr/local/spu-cbc \ 57 ../CbConGCC/configure --prefix=/usr/local/spu-cbc \
58 --build=powerpc --target=spu --program-prefix=spu- \ 58 --build=powerpc --target=spu --program-prefix=spu- \
59 --disable-bootstrap --enable-checking=tree,rtl,assert \ 59 --disable-bootstrap --enable-checking=tree,rtl,assert \
60 --disable-nls --disable-shared --disable-threads \ 60 --disable-nls --disable-shared --disable-threads \
61 --enable-languages=c --with-system-zlib --with-newlib \ 61 --enable-languages=c --with-system-zlib --with-newlib \
62 --enable-version-specific-runtime-libs --disable-libssp \ 62 --enable-version-specific-runtime-libs --disable-libssp \
63 --with-gnu-as -with-as=/usr/bin/spu-as --with-gnu-ld \ 63 --with-gnu-as -with-as=/usr/bin/spu-as --with-gnu-ld \
64 --with-ld=/usr/bin/spu-ld 64 --with-ld=/usr/bin/spu-ld
65 PPU 65 PPU
66 binutils 66 binutils
67 $ tar xzvf binutils-...tar.gz 67 $ tar xzvf binutils-...tar.gz
68 $ mkdir binutils_4ps3 68 $ mkdir binutils_4ps3
69 $ cd binutils_4ps3 69 $ cd binutils_4ps3
118 gdbがインストールされてないので詳細は未調査 118 gdbがインストールされてないので詳細は未調査
119 もしかしてsibcallってあまり実装されてないんじゃ… 119 もしかしてsibcallってあまり実装されてないんじゃ…
120 120
121 121
122 122
123 123 ___________________________________________________________
124 124 PS3用のクロスコンパイラの作成
125 125 -----------------------------------------------------------
126
127 PS3でのGCCのビルドはメモリが少なすぎるためか、insn-*.cのコンパイルに膨
128 大な時間がかかってしまう。
129 なので別のマシンからPS3をターゲットとしたクロスコンパイラを作成する。
130 ただしこれはCbConGCCの開発のためと考えた方が良い。実際にCbC言語を使っ
131 たプログラムをPS3で開発する際はちゃんとPS3上にノンクロスコンパイラを作
132 成しよう。時間はかかるがビルドは可能。
133
134 * 必要なもの
135 o binutilsのソース
136 o gccのソース
137 o ターゲットマシンのlib*.{a,so}類
138 o ターゲットマシンの.hファイル
139 ~/PS3CROSSにクロスコンパイラ環境を整えるとする
140 ~/PS3CROSS/cross-tools: クロスコンパイルに使うツールのインストール先
141 ~/PS3CROSS/sources: ソース置き場、出来上がったら消してもいいよ
142 ~/PS3CROSS/target-env: ターゲット環境(libやinclude)が入ったディレクトリ
143
144 * 準備
145 $ CROSS=$HOME/PS3CROSS
146 $ cd $CROSS
147 $ mkdir sources cross-tools target-env
148 $ cd sources
149 $ wget ... binutilsとかgccのソースをダウンロード
150
151 * binutilsのビルド
152 $ tar xvf binutils..tar.gz
153 $ mkdir PS3-binutils-build; cd !#1
154 $ ../binutils-.../configure --prefix=$CROSS/cross-tools \
155 --with-lib-path=$CROSS/target-env \
156 --hosti686-pc-linux-gnu --build=i686-pc-linux-gnu \
157 --target=ppc64-redhat-linux --enable-64-bit-bfd \
158 --disable-nls --enable-shared --with-sysroot
159 $ make && make install
160
161 * ターゲットマシンの環境をコピーする
162 $ cd $CROSS/target-env
163 $ mkdir include lib lib64
164 $ ln -s . usr
165 ## 必要なライブラリはすべてコピー
166 $ cd lib
167 $ rsync -avl 'charles.cr:/lib/libc[.-_]*' ./
168 $ rsync -avl 'charles.cr:/usr/lib/libc[.-_]*' ./
169 $ rsync -avl 'charles.cr:/usr/lib/crt*' ./
170 $ rsync -avl 'charles.cr:/lib/ld*' ./
171 $ cd ../lib64
172 $ .....
173 ## ヘッダは軽いので全部コピー
174 $ cd ../include
175 $ rsync -avl 'charles.cr:/usr/include/*' ./
176
177 * GCCのビルド
178 $ cd $CROSS/sources
179 $ mkdir PS3-gcc-build; cd !#1
180 $ ../.../configure --prefix=$CROSS/cross-tools
181 --host=i686-pc-linux-gnu --target=ppc64-redhat-linux
182 --with-sysroot=$CROSS/target-env --disable-nls
183 --disable-shared --disable-threads
184 --enable-languages=c --without-headers
185 --disable-bootstrap
186 $ make all-gcc
187 $ make ## エラーで終わるけど気にするな
188 $ make install-gcc
189 $ make install-target-libgcc
190
191 * テスト
192 $ cat >test.c <<EOF
193 #include<stdio.h>
194 int
195 main(int argc, char **argv)
196 {
197 int a=0;
198 int i;
199 for (i=0; i<10; i++) {
200 a = i;
201 }
202 printf("hello world\n");
203 printf("a = %d\n", a);
204 return a;
205 }
206 EOF
207 $ $CROSS/cross-tools/bin/gcc -m32 test.c -o test32
208 $ $CROSS/cross-tools/bin/gcc -m64 test.c -o test64
209 $ file test32 test64
210 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
211 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
212 $ scp test{32,64} PS3Machine:
213 PS3Machine $ ./test32
214
215
216
217
218
219
220