OSDev.org
https://forum.osdev.org/

[Solved] Problems building GCC from source
https://forum.osdev.org/viewtopic.php?f=13&t=33405
Page 1 of 1

Author:  Monolithos [ Sat Dec 29, 2018 11:08 am ]
Post subject:  [Solved] Problems building GCC from source

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:
contrib/download_prerequisites
in source directory.
2. Switched to "build-gcc"
3. Configured GCC like that:
Code:
../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:
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?

Author:  iansjack [ Sat Dec 29, 2018 11:40 am ]
Post subject:  Re: Problems building GCC from source

You don't seem to have specified a target.

Author:  Monolithos [ Sat Dec 29, 2018 11:45 am ]
Post subject:  Re: Problems building GCC from source

According to the documentation found at https://gcc.gnu.org/install/configure.html it should determine the target itself.

Quote:
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:
...
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
...

Author:  max [ Sat Dec 29, 2018 12:13 pm ]
Post subject:  Re: Problems building GCC from source

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

Author:  Monolithos [ Sat Dec 29, 2018 3:20 pm ]
Post subject:  Re: Problems building GCC from source

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!

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/