This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Standardized instructions for cross-compiling toolchain?
- From: Andrew Haley <aph at redhat dot com>
- To: Pip Cet <pipcet at gmail dot com>
- Cc: Michael Habibi <mikehabibi at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Thu, 5 May 2016 16:56:55 +0100
- Subject: Re: Standardized instructions for cross-compiling toolchain?
- Authentication-results: sourceware.org; auth=none
- References: <CAOsp8o-fVfAjgez9ttRw0+ckm+MKOomAXnwURcGmCV+AsMX=oA at mail dot gmail dot com> <572A2247 dot 2020003 at redhat dot com> <CAOqdjBeRRg6-fOqc-RVvJ7Ln94kjRUv+9i4OhiKrZPGg6a0P3Q at mail dot gmail dot com>
On 05/05/2016 04:25 PM, Pip Cet wrote:
> On 5/4/16, Andrew Haley <aph@redhat.com> wrote:
>> On 05/04/2016 05:12 PM, Michael Habibi wrote:
>>
>>> However, my question is more general than that. Are there some
>>> widely-used, accepted steps for building a cross-compiling
>>> toolchain with gcc? I noticed that crosstool-ng does a 3 stage
>>> build, where it builds an initial gcc for libc start files, then
>>> rebuilds gcc for libc, then rebuilds gcc yet again with
>>> libc. Other blogs suggest that two stages are enough. I settled on
>>> doing a 2 stage build. I think my steps are fine, but I think some
>>> of my configure options may need help (prefix vs sysroot vs
>>> prefix+target, etc). But every set of instructions I look at are
>>> different, and it seems no two blog posts, pdfs, wikis have landed
>>> on the same procedure.
>>
>> That's the hard way. The easy way is to grab the root filesystem from
>> your target machine and configure --with-sysroot=<target filesystem>.
>>
>> You really don't have to build libc for your target, and if your
>> target already exists and has a libc you should not do so.
>
> But what if it doesn't? As long as the ABI hasn't been finalized, it
> seems to me the only way to move forward is to rebuild gcc, glibc, and
> binutils in lockstep.
Then you need a really big hammer like crosstool. But almost everyone
wanting a cross-compiler is not in this position. There are not very
many people developing a new ABI. Sure, you exist, I get that.
But for someone simply asking for a way to build a cross-compiling
toolchain, my answer is far more likely to be appropriate.
Andrew.