annotate CbC-INSTALL @ 77:65b2ea5f1266

documents
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 20 Sep 2011 17:16:36 +0900
parents d645ac0f55d6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
33 * test
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
34
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
35 gcc はできないので、cc1 をそのまま使います。
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
36
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
37 % gcc/cc1 -O3 ../cbc-gcc/CbC-examples/conv1.c
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
38
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
39 -O3 は必須。そうでないと正しくコンパイルされません。
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
40
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
41 % gcc ../cbc-gcc/CbC-examples/conv1.s
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
42 % ./a.out 0
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
43 #0193:720
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
44 % ./a.out 1
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
45 #0103:719
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
46 % ./a.out 2
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
47 #0132:470
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
48 % ./a.out 3
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
49 #0165:720
65b2ea5f1266 documents
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
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
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
141 ___________________________________________________________
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
142 PS3用のクロスコンパイラの作成
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
143 -----------------------------------------------------------
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
144
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
145 PS3でのGCCのビルドはメモリが少なすぎるためか、insn-*.cのコンパイルに膨
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
146 大な時間がかかってしまう。
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
147 なので別のマシンからPS3をターゲットとしたクロスコンパイラを作成する。
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
148 ただしこれはCbConGCCの開発のためと考えた方が良い。実際にCbC言語を使っ
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
149 たプログラムをPS3で開発する際はちゃんとPS3上にノンクロスコンパイラを作
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
150 成しよう。時間はかかるがビルドは可能。
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
151
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
152 * 必要なもの
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
153 o binutilsのソース
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
154 o gccのソース
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
155 o ターゲットマシンのlib*.{a,so}類
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
156 o ターゲットマシンの.hファイル
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
157 ~/PS3CROSSにクロスコンパイラ環境を整えるとする
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
158 ~/PS3CROSS/cross-tools: クロスコンパイルに使うツールのインストール先
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
159 ~/PS3CROSS/sources: ソース置き場、出来上がったら消してもいいよ
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
160 ~/PS3CROSS/target-env: ターゲット環境(libやinclude)が入ったディレクトリ
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
161
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
162 * 準備
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
163 $ CROSS=$HOME/PS3CROSS
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
164 $ cd $CROSS
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
165 $ mkdir sources cross-tools target-env
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
166 $ cd sources
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
167 $ wget ... binutilsとかgccのソースをダウンロード
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
168
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
169 * binutilsのビルド
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
170 $ tar xvf binutils..tar.gz
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
171 $ mkdir PS3-binutils-build; cd !#1
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
172 $ ../binutils-.../configure --prefix=$CROSS/cross-tools \
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
173 --with-lib-path=$CROSS/target-env \
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
174 --hosti686-pc-linux-gnu --build=i686-pc-linux-gnu \
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
175 --target=ppc64-redhat-linux --enable-64-bit-bfd \
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
176 --disable-nls --enable-shared --with-sysroot
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
177 $ make && make install
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
178
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
179 * ターゲットマシンの環境をコピーする
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
180 $ cd $CROSS/target-env
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
181 $ mkdir include lib lib64
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
182 $ ln -s . usr
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
183 ## 必要なライブラリはすべてコピー
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
184 $ cd lib
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
185 $ rsync -avl 'charles.cr:/lib/libc[.-_]*' ./
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
186 $ rsync -avl 'charles.cr:/usr/lib/libc[.-_]*' ./
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
187 $ rsync -avl 'charles.cr:/usr/lib/crt*' ./
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
188 $ rsync -avl 'charles.cr:/lib/ld*' ./
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
189 $ cd ../lib64
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
190 $ .....
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
191 ## ヘッダは軽いので全部コピー
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
192 $ cd ../include
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
193 $ rsync -avl 'charles.cr:/usr/include/*' ./
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
194
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
195 * GCCのビルド
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
196 $ cd $CROSS/sources
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
197 $ mkdir PS3-gcc-build; cd !#1
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
198 $ ../.../configure --prefix=$CROSS/cross-tools
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
199 --host=i686-pc-linux-gnu --target=ppc64-redhat-linux
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
200 --with-sysroot=$CROSS/target-env --disable-nls
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
201 --disable-shared --disable-threads
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
202 --enable-languages=c --without-headers
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
203 --disable-bootstrap
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
204 $ make all-gcc
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
205 $ make ## エラーで終わるけど気にするな
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
206 $ make install-gcc
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
207 $ make install-target-libgcc
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
208
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
209 * テスト
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
210 $ cat >test.c <<EOF
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
211 #include<stdio.h>
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
212 int
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
213 main(int argc, char **argv)
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
214 {
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
215 int a=0;
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
216 int i;
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
217 for (i=0; i<10; i++) {
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
218 a = i;
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
219 }
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
220 printf("hello world\n");
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
221 printf("a = %d\n", a);
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
222 return a;
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
223 }
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
224 EOF
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
225 $ $CROSS/cross-tools/bin/gcc -m32 test.c -o test32
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
226 $ $CROSS/cross-tools/bin/gcc -m64 test.c -o test64
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
227 $ file test32 test64
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
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
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
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
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
230 $ scp test{32,64} PS3Machine:
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
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
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
235
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
236
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
237
59194914942b add documents.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
238