GCC fails to build.
Tadeus Prastowo
tadeus.prastowo@unitn.it
Sat Jan 11 21:19:00 GMT 2020
Hello,
On Sat, Jan 11, 2020 at 9:36 PM DAVID STUMPH <DSTUMPH1144@smail.pcd.edu> wrote:
>
> Hello,
>
> I am sorry for not supplying adequate information earlier,
No problem.
> but I will walk you through my
> build process now.
Thanks.
> I was trying to build a cross compiler for my Raspberry Pi 3, because
> compiling programs on there can take a very long time. Its target name is arm-linux-gnueabihf.
>
> My first step was to extract and build the following: gmp-6.1.2, mpc-1.1.0, mpfr-4.0.2, isl-0.22, and
> zstd-1.4.4. AFAIK, gcc doesn't use CLOOG anymore, and uses a new library, zstd. I configured them
> all with "./configure --prefix=/usr/local --disable-shared" and I did "make" and "make install".
>
> I then did step one of the guide, which was to build Binutils. I used the additional option of
> --with-sysroot because otherwise the installed programs wouldn't be portable and I couldn't copy
> them somewhere else without recompiling them.
There is your problem. Indeed, I see that your problem has been fixed
some months ago:
- The problem: https://gcc.gnu.org/ml/gcc-help/2019-09/msg00006.html
- The solution: https://gcc.gnu.org/ml/gcc-help/2019-09/msg00011.html
Perhaps you can try the following modifications to
https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/ since
with the following modifications I can nicely reproduce the blog's
report?
1. Modify Step 4 (Standard C Library Headers and Startup Files) by changing:
1.a. `--prefix=/opt/cross/aarch64-linux' to `--prefix=/' (this will
solve your `cannot find /.../libc.so.6 inside /../install' problem).
1.b. `make install-bootstrap-headers=yes install-headers' to `make
DESTDIR=/opt/cross/aarch64-linux install-bootstrap-headers=yes
install-headers' (this compensates the use of `/' as the prefix).
2. Modify Step 5 (Compiler Support Library) as well by:
2.a Performing the followings before `cd build-gcc':
$ mkdir /opt/cross/aarch64-linux/usr
$ ln -s ../include /opt/cross/aarch64-linux/usr # to solve the PATH_MAX problem
$ rm -Rf build-gcc
2.b. Performing the followings immediately after `cd build-gcc' (i.e.,
GCC needs to be reconfigured with sysroot options to solve the
PATH_MAX problem; so, I decided to start fresh by re-building from
scratch):
$ ../gcc-9.2.0/configure --prefix=/opt/cross --target=aarch64-linux
--enable-languages=c,c++ --disable-multilib
--with-sysroot=/opt/cross/aarch64-linux
--with-build-sysroot=/opt/cross/aarch64-linux
3. Lastly, Step 6 (Standard C Library) is modified to be consistent
with the modified Step 4 by replacing `make install' with `make
DESTDIR=/opt/cross/aarch64-linux install'.
With those modifications, I could pass the test section of the blog
for aarch64-linux. Now I will try your setup because in my setup, I
installed the latest GCC from
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test because
glibc-2.30 needs it.
$ gcc-9 --version
gcc-9 (Ubuntu 9.2.1-17ubuntu1~16.04) 9.2.1 20191102
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
In my setup, to use the latest GCC, after exporting path to the bin
directory (/opt/cross/bin), I aliased gcc-9 and g++-9 as gcc and g++,
respectively:
$ alias gcc=gcc-9 g++=g++-9
> Thanks for any help,
> David
--
Best regards,
Tadeus
More information about the Gcc-help
mailing list