Problem building gcc for cross compiling. [lto1] Error 1

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
nuadok
Posts: 1
Joined: Tue May 12, 2020 12:15 am

Problem building gcc for cross compiling. [lto1] Error 1

Post by nuadok »

Hello. This is my first post. Any help is welcome :D

I am following the tutorial to build gcc for cross compiling:

https://wiki.osdev.org/GCC_Cross-Compiler

I am building in a Lubuntu Virtual Box machine.

I installed all the dependencies listed in the tutorial except:
CLooG (Optional)
ISL (Optional)

Lubuntu doesn't find them.

Since they are optional I tried to build gcc.

To this point all is ok:
---------------------------------------------------------
cd $HOME/src

# The $PREFIX/bin dir _must_ be in the PATH. We did that above.
which -- $TARGET-as || echo $TARGET-as is not in the PATH

mkdir build-gcc
cd build-gcc
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
---------------------------(All above OK)----------------------------

When I apply:

make all-gcc

after a lot of time I get the following error:

++ -no-pie -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o lto1 \
lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-common.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -lisl -lmpc -lmpfr -lgmp -rdynamic -ldl -L./../zlib -lz libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
collect2: error: ld returned 1 exit status
make[1]: *** [../../gcc-10.1.0/gcc/lto/Make-lang.in:88: lto1] Error 1
make[1]: Leaving directory '/home/arbol/src/build-gcc/gcc'
make: *** [Makefile:4390: all-gcc] Error 2


I am using and old PC and the building took more than an hour to finally crash because of this error.

Thanks for your help.
Octocontrabass
Member
Member
Posts: 5575
Joined: Mon Mar 25, 2013 7:01 pm

Re: Problem building gcc for cross compiling. [lto1] Error 1

Post by Octocontrabass »

You haven't included enough of the log to see the actual error message.

What version of GCC and binutils are you using to build your cross-compiler?
Post Reply