Lines 47-65
stage3 chroot. (This is the same chroot you used to install Gentoo.)
Link Here
|
47 |
</section> |
47 |
</section> |
48 |
|
48 |
|
49 |
<section> |
49 |
<section> |
50 |
<title>crossdev</title> |
50 |
<title>Compiling a Cross-Compiler</title> |
51 |
|
51 |
|
52 |
<subsection> |
52 |
<subsection> |
53 |
<title>Intro</title> |
53 |
<title>crossdev</title> |
54 |
<body> |
54 |
<body> |
55 |
<p> |
55 |
<p> |
56 |
Generating a cross-compiler by hand was a long and painful process. This is |
56 |
Generating a cross-compiler by hand was a long and painful process. This is |
57 |
why it has been fully integrated into Gentoo! Our frontend called |
57 |
why it has been fully integrated into Gentoo! Our frontend called |
58 |
<c>crossdev</c> (which you can install with <c>emerge crossdev</c>) will |
58 |
<c>crossdev</c> will run <c>emerge</c> with all of the proper environment |
59 |
run <c>emerge</c> with all of the proper environment variables and install |
59 |
variables and install all the right packages to generate arbitrary |
60 |
all the right packages to generate arbitrary cross-compilers based on your |
60 |
cross-compilers based on your needs. Install crossdev now if you haven't: |
61 |
needs. |
61 |
<pre caption="Install crossdev"> |
|
|
62 |
# <i>emerge crossdev</i> |
63 |
</pre> |
64 |
<note> |
65 |
Be sure to install the ~keyworded version of crossdev for all the latest fixes. |
66 |
</note> |
67 |
<note> |
68 |
If you are upgrading from an older version of crossdev, and have crossdev-wrappers |
69 |
installed, please uninstall crossdev-wrappers first. All your existing cross-toolchains |
70 |
will remain intact. |
71 |
</note> |
72 |
</p> |
73 |
<p> |
74 |
We only cover the basic usage of crossdev here, but crossdev can customize |
75 |
the process fairly well for most needs. Execute the following command to |
76 |
get more information about crossdev usage: |
77 |
<pre caption="crossdev Usage"> |
78 |
# <i>crossdev --help</i> |
79 |
</pre> |
80 |
Here are some examples with some of the most useful options: |
81 |
<pre caption="Useful crossdev options"> |
82 |
# <i>crossdev --g [gcc version] --l [(g)libc version] --b [binutils version] --k [kernel headers version] -P -v -t [tuple]</i> # use specific versions |
83 |
# <i>crossdev -S -P -v -t [tuple]</i> # use stable only |
84 |
</pre> |
62 |
</p> |
85 |
</p> |
|
|
86 |
|
63 |
</body> |
87 |
</body> |
64 |
</subsection> |
88 |
</subsection> |
65 |
|
89 |
|
Lines 110-115
stage3 chroot. (This is the same chroot you used to install Gentoo.)
Link Here
|
110 |
temporarily change your profile. |
134 |
temporarily change your profile. |
111 |
</note> |
135 |
</note> |
112 |
|
136 |
|
|
|
137 |
<p> |
138 |
To find out which tuple you should use, look over the output from the |
139 |
following command: |
140 |
</p> |
141 |
<pre caption="crossdev Tuples"> |
142 |
# <i>crossdev -t help</i> |
143 |
</pre> |
144 |
|
145 |
<p> |
146 |
When you are done (after a few hours), you find a newly compiled cross-compiler |
147 |
in the sysroot at <path>/usr/CTARGET/</path>. We highly recommend you |
148 |
package this up so you don't end up waiting another two to three hours |
149 |
every time you mess up your sysroot and need to reinstall. |
150 |
</p> |
151 |
|
152 |
<pre caption="quickpkg that sysroot!"> |
153 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/gcc</i> |
154 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/glibc</i> |
155 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/binutils</i> |
156 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/linux-headers</i> |
157 |
</pre> |
158 |
|
159 |
<note> |
160 |
If quickpkg warns you about excluded files, please follow its prompts |
161 |
to include all files. |
162 |
</note> |
163 |
|
164 |
<p> |
165 |
In the future you can reinstall your sysroot by executing the following |
166 |
simple portage command: |
167 |
</p> |
168 |
|
169 |
<pre caption="Emerge that quickpkg!"> |
170 |
# <i>emerge -k cross-sh4-unknown-linux-gnu/gcc cross-sh4-unknown-linux-gnu/glibc cross-sh4-unknown-linux-gnu/binutils cross-sh4-unknown-linux-gnu/linux-headers</i> |
171 |
</pre> |
172 |
|
113 |
</body> |
173 |
</body> |
114 |
</subsection> |
174 |
</subsection> |
115 |
<subsection> |
175 |
<subsection> |
Lines 117-139
stage3 chroot. (This is the same chroot you used to install Gentoo.)
Link Here
|
117 |
<body> |
177 |
<body> |
118 |
<p> |
178 |
<p> |
119 |
If everything goes as planned, you should have a shiny new compiler on your |
179 |
If everything goes as planned, you should have a shiny new compiler on your |
120 |
machine. Give it a spin! |
180 |
machine. Give it a spin! |
121 |
</p> |
181 |
</p> |
122 |
|
182 |
|
123 |
<pre caption="Using SH4 cross-compiler"> |
183 |
<pre caption="Using SH4 cross-compiler"> |
124 |
$ <i>sh4-unknown-linux-gnu-gcc --version</i> |
184 |
# <i>sh4-unknown-linux-gnu-gcc --version</i> |
125 |
sh4-unknown-linux-gnu-gcc (GCC) 4.2.0 (Gentoo 4.2.0 p1.4) |
185 |
sh4-unknown-linux-gnu-gcc (GCC) 4.2.0 (Gentoo 4.2.0 p1.4) |
126 |
Copyright (C) 2007 Free Software Foundation, Inc. |
186 |
Copyright (C) 2007 Free Software Foundation, Inc. |
127 |
This is free software; see the source for copying conditions. There is NO |
187 |
This is free software; see the source for copying conditions. There is NO |
128 |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
188 |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
129 |
$ <i>echo 'int main(){return 0;}' > sh4-test.c</i> |
189 |
# <i>echo 'int main(){return 0;}' > sh4-test.c</i> |
130 |
$ <i>sh4-unknown-linux-gnu-gcc -Wall sh4-test.c -o sh4-test</i> |
190 |
# <i>sh4-unknown-linux-gnu-gcc -Wall sh4-test.c -o sh4-test</i> |
131 |
$ <i>file sh4-test</i> |
191 |
# <i>file sh4-test</i> |
132 |
sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped |
192 |
sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped |
133 |
</pre> |
193 |
</pre> |
134 |
|
194 |
|
135 |
<p> |
195 |
<p> |
136 |
If the crossdev command failed, you have the log file which you can review |
196 |
If the crossdev command failed, you are told the log file which you can review |
137 |
to see if the problem is local. If you're unable to fix the issue, you're |
197 |
to see if the problem is local. If you're unable to fix the issue, you're |
138 |
welcome to file a bug in our bugzilla. See the |
198 |
welcome to file a bug in our bugzilla. See the |
139 |
<uri link="communication.xml">Communication page</uri> for more information. |
199 |
<uri link="communication.xml">Communication page</uri> for more information. |
Lines 146-153
sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux
Link Here
|
146 |
<body> |
206 |
<body> |
147 |
<p> |
207 |
<p> |
148 |
To uninstall a toolchain, simply use the <c>--clean</c> option. If you |
208 |
To uninstall a toolchain, simply use the <c>--clean</c> option. If you |
149 |
modified the sysroot by hand, you'll be prompted to delete things inside |
209 |
modified the sysroot by hand, you'll be prompted to delete every file |
150 |
of it, so you may want to pipe <c>yes |</c> into the command. |
210 |
inside, so you will want to prepend <c>yes |</c> to this command <b>if</b> |
|
|
211 |
you are sure. |
151 |
</p> |
212 |
</p> |
152 |
|
213 |
|
153 |
<pre caption="Uninstalling cross-compiler"> |
214 |
<pre caption="Uninstalling cross-compiler"> |
Lines 162-176
sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux
Link Here
|
162 |
</body> |
223 |
</body> |
163 |
</subsection> |
224 |
</subsection> |
164 |
|
225 |
|
165 |
<subsection> |
|
|
166 |
<title>Options</title> |
167 |
<body> |
168 |
<p> |
169 |
Obviously crossdev can do a lot more, so to find out more, simply run |
170 |
<c>crossdev --help</c>. |
171 |
</p> |
172 |
</body> |
173 |
</subsection> |
174 |
</section> |
226 |
</section> |
175 |
|
227 |
|
176 |
<section> |
228 |
<section> |
Lines 186-201
binutils/(glibc|uclibc)/gcc all by themselves. This section is <b>not</b>
Link Here
|
186 |
meant to cover/document/whatever the myriad of build failures you are likely |
238 |
meant to cover/document/whatever the myriad of build failures you are likely |
187 |
to see along the way. If you need such help, see the |
239 |
to see along the way. If you need such help, see the |
188 |
<uri link="the-more-you-know.xml">Beyond section</uri> in the handbook for |
240 |
<uri link="the-more-you-know.xml">Beyond section</uri> in the handbook for |
189 |
some pointers. You certainly should not bug me or anyone else in Gentoo. |
241 |
some pointers. |
190 |
</warn> |
242 |
</warn> |
191 |
|
243 |
|
192 |
<warn> |
244 |
<warn> |
|
|
245 |
Let's be very clear: we do <b>not</b> support toolchains which are built by hand! |
246 |
</warn> |
247 |
|
248 |
<note> |
193 |
If you're still reading, you should really check out the crosstool project |
249 |
If you're still reading, you should really check out the crosstool project |
194 |
(refer to the <uri link="the-more-you-know.xml">Beyond section</uri>) as |
250 |
(refer to the <uri link="the-more-you-know.xml">Beyond section</uri>) as |
195 |
that provides a distribution independent method for generating cross-compilers. |
251 |
that provides a distribution independent method for generating cross-compilers. |
196 |
While it does kind of suck (imo), it is certainly the best (and really only) |
252 |
While it does kind of suck (imo), it is certainly the best (and really only) |
197 |
option out there for creating cross-compilers. |
253 |
option out there for creating cross-compilers. |
198 |
</warn> |
254 |
</note> |
199 |
</body> |
255 |
</body> |
200 |
</subsection> |
256 |
</subsection> |
201 |
|
257 |
|
202 |
- |
|
|