[Bug target/82408] cross-compiling for arm64 problems

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 3 02:25:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82408

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Peter Bohning from comment #9)
> No.  I think you've misunderstood the problem and I mean I can't test it
> because I don't have a computer now but.. 

No I am not misunderstanding the problem.  You misconfigured the gcc.

> 
> Like I said I'm doing this to get the libstdc++ library for aarch64, I
> already am using the linaro toolchain to actually cross-compile things.

The linaro toolchain already includes a libstdc++ library so there is no reason
why you need to recompile GCC/libstdc++ here.

> 
> And as I recall, "target" defaults to "host".

It does not.  Read
https://gcc.gnu.org/install/configure.html


> By marking this bug "invalid" and "resolved" you're also neglecting that
> these various things I ran into are at the very least bad practice even if
> your claim that just using "target" and not "host" will somehow pick just
> the right defines to get this tangled mess of C++ code to compile.

No I have not.  You are misunderstanding GCC's configure options.  There are
three different triplets and I described them above (this is documented in the
configure/autoconf documentation; look for canadian cross).

You still did not describe what kind of cross compiler you want?  Do you want
one which runs on x86_64 (and built on x86_64) that targets aarch64 if so then
just --target= is needed.  If you want one which runs on aarch64 (was built on
x86_64 that targets aarch64), then --host= and --target= is needed but you
first need a cross that RUNS on x86_64 to be able to build the target libraries
like libstdc++.

Since you have the linaro toolchain you don't need to build glibc; you can use
that sysroot to build the full gcc.

Now compiling cross toolchains are not hard but require you to pay attention to
all three tiplets and understand what the uses are.

The problems you are running into are very simple, you are trying to build a
canadian cross compiler but using an older GCC (6) cross compiler to get the
target libraries built.  The target libraries require a cross compiler which is
the same version as the "canadian" cross compiler.

That is you need a GCC 7 cross compiler that targets aarch64 which is hosted on
x86_64 (and built on x86_64) to be able to build the target libraries for a
compiler which is hosted on aarch64 targeting aarch64 (but built on x86_64).

So again this is invalid because you are using the wrong cross compiler to
build the target libraries and not understanding the three triplets (build,
host and target).  I hope this long message allows you to understand the three
tiplets better than I explained before.


More information about the Gcc-bugs mailing list