Mercurial > hg > CbC > CbC_gcc
annotate CbC-INSTALL @ 97:4d6300120c29 cbc-gcc-4.6.0
modify condition of tail call in expand_call method
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Jan 2012 04:48:59 +0900 |
parents | 65b2ea5f1266 |
children |
rev | line source |
---|---|
29
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 * CbC on GCCのインストール方法 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 まずはMercurialリポジトリから取得 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 hg clone ssh://one@firefly.cr/hg/CbC/GCC cbc-gcc |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 ビルド用ディレクトリへ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 mkdir build-gcc; cd build-gcc |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 コンフィギュア |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 一般的には以下のconfigureでビルドできる |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 ../cbc-gcc/configure CFLAGS="-g3 -O0" |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 --prefix=$PWD/INSTALL_DIR --disable-nls \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 --disable-bootstrap --enable-languages=c \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 --enable-checking=tree,rtl,assert,types |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 -g3: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 gdbでmacroの展開を可能にする |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 -O0: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 gdbでトレースしやすいように、最適化をカット |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 --prefix: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 インストールするベースディレクトリ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 --enbale-checking: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 デバグ用の指定、browse_treeやdebug_rtx、assertもこれでonになる |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 --disable-bootstrap: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 通常、GCCは3回ビルドされる。それを最初の1回だけに限定 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 --disable-nls: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 gettextのl10nをoffにしよう |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 --enable-language: |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 使用する言語 c|c++|ada ... もちろんCbCはcだけ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 これもcbcを使えるようにしたい |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 ビルド |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 make && make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 |
77 | 33 * test |
34 | |
35 gcc はできないので、cc1 をそのまま使います。 | |
36 | |
37 % gcc/cc1 -O3 ../cbc-gcc/CbC-examples/conv1.c | |
38 | |
39 -O3 は必須。そうでないと正しくコンパイルされません。 | |
40 | |
41 % gcc ../cbc-gcc/CbC-examples/conv1.s | |
42 % ./a.out 0 | |
43 #0193:720 | |
44 % ./a.out 1 | |
45 #0103:719 | |
46 % ./a.out 2 | |
47 #0132:470 | |
48 % ./a.out 3 | |
49 #0165:720 | |
50 | |
29
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 * PowerPC Macでのインストール |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 最新のlibgmp, libmpfrをインストール |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 [gmp] |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 ./configure --enable-cxx --build=powerpc-apple-darwin9 --host=powerpc-apple-darwin9 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 make && make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 [mpfr] |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 ./configure --build=powerpc-apple-darwin9 --host=powerpc-apple-darwin9 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 make && make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 [CbC on GCC] |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 ../cbc-gcc/configure CFLAGS="-g3 -O0" --with-gmp=/usr/local |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 --with-mpfr=/usr/local --prefix=$PWD/INSTALL_DIR \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 --disable-nls --disable-bootstrap --enable-languages=c \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 --enable-checking=tree,rtl,assert,types |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 make && make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 もちろんインストール場所によってprefixは変更しよう |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 * PS3でのビルド |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 SPU |
45
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
75 $ ../GCC/configure CFLAGS='-g -O0' --prefix=$PWD/INSTALL_DIR |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
76 --disable-nls --disable-shared --disable-threads |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
77 --enable-checking=tree,rtl,assert --with-system-zlib |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
78 --with-newlib --enable-languages=c |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
79 --enable-version-specific-runtime-libs --disable-libssp |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
80 --program-prefix=cbc-spu- --target=spu --disable-bootstrap |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
81 $ make && make install |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
82 $ cd INSTALL_DIR; ln -s /usr/spu; cd .. |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
83 で、動作確認のあと |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
84 $ sudo make prefix=/usr/local/cbc install |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
85 $ cd /usr/local/cbc; ln -s /usr/spu; cd - |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
86 |
29
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 PPU |
45
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
88 $ ../GCC/configure --prefix=$PWD/INSTALL_DIR |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
89 --host=ppc64-redhat-linux --build=ppc64-redhat-linux |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
90 --target=ppc64-redhat-linux --program-prefix=cbc- --disable-bootstrap |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
91 --enable-checking=tree,rtl,assert --disable-nls --enable-shared |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
92 --enable-thread=posix --enable-languages=c --with-system-zlib |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
93 --enable-__cxa_atexit --disable-libunwind-exceptions --disable-dssi |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
94 --enable-plugin --with-long-double-128 --with-gnu-as |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
95 --with-as=/usr/bin/as --with-gnu-ld --with-ld=/usr/bin/ld |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
96 --with-cpu=default32 |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
97 $ make && make install |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
98 動作確認 |
d645ac0f55d6
add instration howto for PS3 to CbC-INSTALL.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
99 $ make prefix=/usr/local/cbc install |
29
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 * 琉球大学総合情報センターのSolarisサーバでのビルド (sparc) |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
104 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
105 なぜかデフォルトのgccが自分のライブラリすら見てくれないのでパスを指定 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
106 export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/gcc:$HOME/opt/lib |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 export LIBRARY_PATH=/usr/local/lib:/usr/local/lib/gcc:$HOME/opt/lib |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 gmpのインストール |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 ./configure --prefix=$HOME/opt \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110 --build=sparc-sun-solaris \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 --host=sparc-sun-solaris |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 make |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 make check |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 libmpfrのインストール |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 ./configure --prefix=$HOME/opt/ \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 --with-gmp=$HOME/opt |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118 --build=sparc-sun-solaris \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 --host=sparc-sun-solaris |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 make |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
121 make check |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123 # sparc-sun-solaris2.10の方がいいかもしれない |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124 CbCをインストール |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
125 ../CbCGCC/configure --prefix=$PWD/INSTALL_DIR --disable-nls \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126 --disable-bootstrap --enable-languages=c \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
127 --with-gmp=$HOME/opt --with-mpfr=$HOME/opt \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
128 --build=sparc-sun-solaris2.10 --target=sparc-sun-solaris2.10 \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
129 --host=sparc-sun-solaris2.10 --enable-shared \ |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
130 --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
131 make |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
132 make install |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
133 ビルドは可能。 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
134 ただし、実行は不能 goto cs();すら動かない |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
135 config/sparc/sparc.cのoutput_sibcall()でエラーが出る |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
136 gdbがインストールされてないので詳細は未調査 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 もしかしてsibcallってあまり実装されてないんじゃ… |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 |
32 | 141 ___________________________________________________________ |
142 PS3用のクロスコンパイラの作成 | |
143 ----------------------------------------------------------- | |
144 | |
145 PS3でのGCCのビルドはメモリが少なすぎるためか、insn-*.cのコンパイルに膨 | |
146 大な時間がかかってしまう。 | |
147 なので別のマシンからPS3をターゲットとしたクロスコンパイラを作成する。 | |
148 ただしこれはCbConGCCの開発のためと考えた方が良い。実際にCbC言語を使っ | |
149 たプログラムをPS3で開発する際はちゃんとPS3上にノンクロスコンパイラを作 | |
150 成しよう。時間はかかるがビルドは可能。 | |
151 | |
152 * 必要なもの | |
153 o binutilsのソース | |
154 o gccのソース | |
155 o ターゲットマシンのlib*.{a,so}類 | |
156 o ターゲットマシンの.hファイル | |
157 ~/PS3CROSSにクロスコンパイラ環境を整えるとする | |
158 ~/PS3CROSS/cross-tools: クロスコンパイルに使うツールのインストール先 | |
159 ~/PS3CROSS/sources: ソース置き場、出来上がったら消してもいいよ | |
160 ~/PS3CROSS/target-env: ターゲット環境(libやinclude)が入ったディレクトリ | |
161 | |
162 * 準備 | |
163 $ CROSS=$HOME/PS3CROSS | |
164 $ cd $CROSS | |
165 $ mkdir sources cross-tools target-env | |
166 $ cd sources | |
167 $ wget ... binutilsとかgccのソースをダウンロード | |
168 | |
169 * binutilsのビルド | |
170 $ tar xvf binutils..tar.gz | |
171 $ mkdir PS3-binutils-build; cd !#1 | |
172 $ ../binutils-.../configure --prefix=$CROSS/cross-tools \ | |
173 --with-lib-path=$CROSS/target-env \ | |
174 --hosti686-pc-linux-gnu --build=i686-pc-linux-gnu \ | |
175 --target=ppc64-redhat-linux --enable-64-bit-bfd \ | |
176 --disable-nls --enable-shared --with-sysroot | |
177 $ make && make install | |
178 | |
179 * ターゲットマシンの環境をコピーする | |
180 $ cd $CROSS/target-env | |
181 $ mkdir include lib lib64 | |
182 $ ln -s . usr | |
183 ## 必要なライブラリはすべてコピー | |
184 $ cd lib | |
185 $ rsync -avl 'charles.cr:/lib/libc[.-_]*' ./ | |
186 $ rsync -avl 'charles.cr:/usr/lib/libc[.-_]*' ./ | |
187 $ rsync -avl 'charles.cr:/usr/lib/crt*' ./ | |
188 $ rsync -avl 'charles.cr:/lib/ld*' ./ | |
189 $ cd ../lib64 | |
190 $ ..... | |
191 ## ヘッダは軽いので全部コピー | |
192 $ cd ../include | |
193 $ rsync -avl 'charles.cr:/usr/include/*' ./ | |
194 | |
195 * GCCのビルド | |
196 $ cd $CROSS/sources | |
197 $ mkdir PS3-gcc-build; cd !#1 | |
198 $ ../.../configure --prefix=$CROSS/cross-tools | |
199 --host=i686-pc-linux-gnu --target=ppc64-redhat-linux | |
200 --with-sysroot=$CROSS/target-env --disable-nls | |
201 --disable-shared --disable-threads | |
202 --enable-languages=c --without-headers | |
203 --disable-bootstrap | |
204 $ make all-gcc | |
205 $ make ## エラーで終わるけど気にするな | |
206 $ make install-gcc | |
207 $ make install-target-libgcc | |
208 | |
209 * テスト | |
210 $ cat >test.c <<EOF | |
211 #include<stdio.h> | |
212 int | |
213 main(int argc, char **argv) | |
214 { | |
215 int a=0; | |
216 int i; | |
217 for (i=0; i<10; i++) { | |
218 a = i; | |
219 } | |
220 printf("hello world\n"); | |
221 printf("a = %d\n", a); | |
222 return a; | |
223 } | |
224 EOF | |
225 $ $CROSS/cross-tools/bin/gcc -m32 test.c -o test32 | |
226 $ $CROSS/cross-tools/bin/gcc -m64 test.c -o test64 | |
227 $ file test32 test64 | |
228 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 | |
229 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 | |
230 $ scp test{32,64} PS3Machine: | |
231 PS3Machine $ ./test32 | |
29
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
232 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
233 |
cc07adb17855
deleting old commented out code.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
234 |
32 | 235 |
236 | |
237 | |
238 |