Page 1 of 1

[Solved] Problems building GCC from source

Posted: Sat Dec 29, 2018 11:08 am
by Monolithos
Hello,
(I hope this is the right place to ask this question)

I am trying to build GCC as a native system C/C++ compiler from source.

For some reason I'm facing errors that don't give very much information about what I'm doing wrong.

My system is Debian Stretch.
The GCC version I'm trying to build is 6.4.0.

The source is contained in ~/opt/gcc-6.4.0
The output is to be placed in ~/opt/build-gcc

What I have done so far:

1. Excexuted

Code: Select all

contrib/download_prerequisites
in source directory.
2. Switched to "build-gcc"
3. Configured GCC like that:

Code: Select all

../gcc-6.4.0/configure \
--prefix=$HOME/opt/gcc-6.4.0/ \
--enable-languages=c,c++ \
--disable-nls  \
--disable-werror \
--with-gmp \
--enable-multilib
After that, running "make" inside of "build-gcc" aborts like this:

Code: Select all

make[2]: Leaving directory '/home/userid/opt/build-gcc'
Makefile:23999: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/home/userid/opt/build-gcc'
Makefile:921: recipe for target 'all' failed
make: *** [all] Error 2
I'm stucked at this point. What am I doing wrong?

Re: Problems building GCC from source

Posted: Sat Dec 29, 2018 11:40 am
by iansjack
You don't seem to have specified a target.

Re: Problems building GCC from source

Posted: Sat Dec 29, 2018 11:45 am
by Monolithos
According to the documentation found at https://gcc.gnu.org/install/configure.html it should determine the target itself.
GCC has code to correctly determine the correct value for target for nearly all native systems. Therefore, we highly recommend you do not provide a configure target when configuring a native compiler.


So I didn't specify the target on purpose.

The Makefile generated from configure also seems to have the correct target specified

Code: Select all

...
build_alias=x86_64-pc-linux-gnu
build_vendor=pc
build_os=linux-gnu
build=x86_64-pc-linux-gnu
host_alias=x86_64-pc-linux-gnu
host_vendor=pc
host_os=linux-gnu
host=x86_64-pc-linux-gnu
target_alias=x86_64-pc-linux-gnu
target_vendor=pc
target_os=linux-gnu
target=x86_64-pc-linux-gnu
...

Re: Problems building GCC from source

Posted: Sat Dec 29, 2018 12:13 pm
by max
Hey,

check the log for where the actual error occurs. The part you posted is just the end of the log where it says it failed. The actual error came up earlier.

Greets

Re: Problems building GCC from source

Posted: Sat Dec 29, 2018 3:20 pm
by Monolithos
There was an error in the output of make
(I'd like to post the error message but was logged out for inactivity when I wanted to preview
so the already written text is gone and it also vanished from the terminal after starting make check-gcc)

Apparently there actually were some C-libraries missing #-o

Installing libc6-dev-x32, libc6-i386, libc6-x32, libc6-dev-i386 did the trick.

I don't know why they where missing

It compiled and passed the checks succesfully.

Thank you!