Cross compiling GCC for aarch64
markmi at dsl-only.net
Mon Oct 9 21:26:08 UTC 2017
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:
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
markmi at dsl-only.net
More information about the freebsd-ports