Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Oct 2017 02:15:46 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Tarjei Jensen <tarjei99@gmail.com>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: Cross compiling GCC for aarch64
Message-ID:  <0136AF00-0DFA-4764-8CFC-28D10421420A@dsl-only.net>
In-Reply-To: <CAGxNqfAe4W=T3GQTS8st9FrcFS%2BMM8_WeXpZzC3zaah=9D-nwQ@mail.gmail.com>
References:  <0E044060-82AF-4CCA-953C-3616E76B33C3@dsl-only.net> <CAGxNqfAe4W=T3GQTS8st9FrcFS%2BMM8_WeXpZzC3zaah=9D-nwQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 :
>>=20
>> > 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.
>>=20
>>=20
>> I had trouble following this. I had to look up
>> "Canadian Cross", which I found in:
>>=20
>> https://en.wikipedia.org/wiki/Cross_compiler
>>=20
>> Canadian Cross has 3 "machines": A, B, and C.
>>=20
>> (A) is used to bootstrap a compiler/toolchain
>>     to run native on (B). (This can have multiple
>>     stages, including a cross compile stage.)
>>=20
>> (B) is used to bootstrap a cross compiler/toolchain
>>     to run on (B) to produce materials for (C).
>>=20
>> (C) runs the output from (B)'s cross compiler
>>     but normally does not have its own self-hosted
>>     compiler/toolchain or any cross compilers.
>>=20
>> If I read what you wrote correctly you are looking
>> more for (B) and (C) not being distinct.
>>=20
>> Or am I wrong and you want(?):
>>=20
>> (A) to be a amd64 (i386?) FreeBSD 11.1 context
>>=20
>> (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
>>=20
>> (C) to be aarch64 FreeBSD 12 having its own
>>     compiler for targeting itself [copied from
>>     (B)].
>>=20
>> ?
>=20
> =46rom the first paragraph :
>  It is about cross compiling gcc from ports so that it will work on =
aarch64 FreeBSD 12-CURRENT.=20
>=20
> 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.

=3D=3D=3D
Mark Millard
markmi at dsl-only.net





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0136AF00-0DFA-4764-8CFC-28D10421420A>