Cross compiling GCC for aarch64
Mark Millard
markmi at dsl-only.net
Tue Oct 10 09:15:51 UTC 2017
On 2017-Oct-9, at 11:22 PM, Tarjei Jensen <tarjei99 at gmail.com> wrote:
>> On Mon, Oct 9, 2017 at 11:26 PM, Mark Millard <markmi at dsl-only.net> wrote:
>> Tarjei Jensen tarjei99 at gmail.com wrote on
>> Mon Oct 9 17:16:41 UTC 2017 :
>>
>> > This does NOT concern making a cross compiler. It is about cross compiling
>> > gcc from ports so that it will work on aarch64 FreeBSD 12-CURRENT.
>> >
>> > I have managed to create my own ports which allow me to use gcc6 as a cross
>> > compiler on x86 Freebsd 11.1 with aarch64 FreeBSD 12-CURRENT being the
>> > target. It seems to work fine.
>> >
>> > The problem is that I want the GNU Ada compiler (gnat). It requires a
>> > working Ada compiler to compile parts of the compiler. There is a gcc6-aux
>> > pkg and port which uses v11 binaries. However it does *not* work on FreeBSD
>> > 12. It can compile, but the resulting executables does not work. And the
>> > gdb skills needed to find out why is simply beyond me.
>> >
>> > As I understand, what I am attempting is called a Canadian Cross.
>> >
>> > My plan would be to use the ports system to do this. e.g. by doing a "make
>> > build". Create a tarball of the result and unpack on the target system and
>> > do a "make install". Or make a pkg. Whatever works.
>> >
>> > I seem to have found the parameters to use for running the configure
>> > script, but I would very much like to use the ports way.
>> >
>> > Can anybody explain or point to an article which explains how to use the
>> > Canadian Cross to cross compile gcc?
>> >
>> > Suggestions and pointers to documentation are very much appreciated.
>>
>>
>> I had trouble following this. I had to look up
>> "Canadian Cross", which I found in:
>>
>> https://en.wikipedia.org/wiki/Cross_compiler
>>
>> Canadian Cross has 3 "machines": A, B, and C.
>>
>> (A) is used to bootstrap a compiler/toolchain
>> to run native on (B). (This can have multiple
>> stages, including a cross compile stage.)
>>
>> (B) is used to bootstrap a cross compiler/toolchain
>> to run on (B) to produce materials for (C).
>>
>> (C) runs the output from (B)'s cross compiler
>> but normally does not have its own self-hosted
>> compiler/toolchain or any cross compilers.
>>
>> If I read what you wrote correctly you are looking
>> more for (B) and (C) not being distinct.
>>
>> Or am I wrong and you want(?):
>>
>> (A) to be a amd64 (i386?) FreeBSD 11.1 context
>>
>> (B) to be amd64(?) FreeBSD 12 for
>> cross compiling to aarch64 FreeBSD 12
>> and used to produce an aarch64 compiler
>> for use on aarch64 FreeBSD 12
>>
>> (C) to be aarch64 FreeBSD 12 having its own
>> compiler for targeting itself [copied from
>> (B)].
>>
>> ?
>
> From the first paragraph :
> It is about cross compiling gcc from ports so that it will work on aarch64 FreeBSD 12-CURRENT.
>
> I have a working cross compiler.
You also wrote (see earlier above):
>> Can anybody explain or point to an article which explains how to use the
>> Canadian Cross to cross compile gcc?
That and "I have a working cross compiler" together
still leaves me just as confused for how the
"Canadian Cross" pattern is supposed to be involved,
at least for the description I found of what the
phrase refers to. Two stages of producing cross
compilers (A->B and B->C) seemed essential to what
is described as the pattern involved.
Clearly I'm to be of no help for this. Sorry to have
wasted your time.
===
Mark Millard
markmi at dsl-only.net
More information about the freebsd-ports
mailing list