0

I'm building GCC 8.5.0 on a Devuan Chimaera GNU/Linux system (using GCC 10). I've configured with ./configure --disable-gnat, then ran make. At some point, I get:

echo timestamp > s-selftest-c
rm gcc.pod
make[3]: Leaving directory '/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc'
Checking multilib configuration for libgcc...
Configuring stage 1 in x86_64-pc-linux-gnu/libgcc
configure: loading cache ./config.cache
configure: error: `CC' has changed since the previous run:
configure:   former value:  `/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc/xgcc -B/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc/ -B/opt/gcc-8.5.0/x86_64-pc-linux-gnu/bin/ -B/opt/gcc-8.5.0/x86_64-pc-linux-gnu/lib/ -isystem /opt/gcc-8.5.0/x86_64-pc-linux-gnu/include -isystem /opt/gcc-8.5.0/x86_64-pc-linux-gnu/sys-include   '
configure:   current value: `/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc/xgcc -B/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include   '
configure: error: in `/usr/local/src/gcc-8.5.0/x86_64-pc-linux-gnu/libgcc':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
make[2]: *** [Makefile:18716: configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory '/usr/local/src/gcc-8.5.0'
make[1]: *** [Makefile:24352: stage1-bubble] Error 2
make[1]: Leaving directory '/usr/local/src/gcc-8.5.0'
make: *** [Makefile:945: all] Error 2

Why is this happening? I tried make distclean and repeating the process, but it didn't help.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • 2
    It loks like you configured in the source directory. This is not recommended. – stark Feb 07 '22 at 19:48
  • @stark: What _is_ recommended? – einpoklum Feb 07 '22 at 20:07
  • 1
    Following the directions: http://gcc.gnu.org/install/ – stark Feb 07 '22 at 20:11
  • To perform a (wholly) out-of-source build, which is what the docs recommend, create a build directory outside the source directory, make that the current working directory, and run GCC's `configure` script from there. That would be something like `../gcc_src/configure --option1 ...`. Run `make` from the same place. Support for such out-of-source building is standard in GNU build systems, but how strongly devs recommend exercising that alternative varies. – John Bollinger Feb 07 '22 at 20:33
  • I'm not so sure that the in-source building is related to the problem, but since you're having trouble, changing to an out-of-source build is a good place to start. – John Bollinger Feb 07 '22 at 20:36
  • Example configuring gcc-8.5.0 https://drive.google.com/file/d/1ynCtdCJFZEUgtfjuuQuiRSG8W_m1rFhm/view?usp=sharing – Knud Larsen Feb 07 '22 at 22:17
  • @KnudLarsen: Can you put that someplace more publicly accessible? – einpoklum Feb 07 '22 at 22:26
  • "more publicly accessible" : Any suggestions ? – Knud Larsen Feb 08 '22 at 11:39
  • @KnudLarsen: I meant something like pastebin. But I understand what you mean and will try this today. – einpoklum Feb 08 '22 at 11:40

1 Answers1

0

GCC build prerequisites ...

# apt install g++ autoconf libtool gawk flex bison binutils-dev libelf-dev texinfo zlib1g-dev

Example configuring gcc-8.5.0

tar xvf gcc-8.5.0.tar.xz 
cd gcc-8.5.0/

tar xvf mpfr-4.0.2.tar.xz && mv -v mpfr-4.0.2 mpfr
tar xvf gmp-6.1.2.tar.xz && mv -v gmp-6.1.2 gmp
tar xvf mpc-1.1.0.tar.gz && mv -v mpc-1.1.0 mpc

cd ../
mkdir build-gcc850
cd build-gcc850/

export CC=gcc73 CXX=g++73 && \
../gcc-8.5.0/configure --prefix=/usr/local/gcc85 \
--program-suffix=85 --enable-languages=c,c++,fortran \
--disable-multilib --disable-libstdcxx-pch --with-system-zlib
Knud Larsen
  • 5,753
  • 2
  • 14
  • 19