GCC generating corrupted dependency files

129 Views Asked by At

I've got a weird issue with compiling GCC that I can't seem to figure out.

  • What I'm trying to compile: gcc v12.2.0 (via make bootstrap)
  • What I'm compiling with: gcc v11.2.0
  • Configure command: ../configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap --enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-threads=posix --enable-checking=release --enable-objc-gc --with-system-zlib --enable-libstdcxx-dual-abi --with-default-libstdcxx-abi=new --disable-libstdcxx-pch --disable-libunwind-exceptions --enable-__cxa_atexit --disable-libssp --enable-gnu-unique-object --enable-plugin --enable-lto --disable-install-libiberty --disable-werror --with-gnu-ld --with-isl --verbose --with-arch-directory=amd64 --disable-gtktest --enable-clocale=gnu --disable-multilib --target=x86_64-slackware-linux --build=x86_64-slackware-linux --host=x86_64-slackware-linux
  • Build environment: Docker image (Slackware x86_64 v15.0)
  • Host environment: I've managed to reproduce this on two different hosts: one is running Ubuntu (x86_64, v20.04.5); the other is running Windows 10.

The issue: Sometimes (about half the time), the build fails with something similar to the following:

make[4]: Entering directory '/tmp/gcc-12.2.0/gcc.build.lnx/prev-gcc'
rm -f stamp-gnatlib2-rts stamp-tools
d/.deps/opover.Po:1: *** target pattern contains no '%'.  Stop.
make[4]: Leaving directory '/tmp/gcc-12.2.0/gcc.build.lnx/prev-gcc'
make[3]: *** [Makefile:3279: stmp-fixinc] Error 2
make[3]: *** Waiting for unfinished jobs....
rm gcc.pod gfortran.pod gccgo.pod gdc.pod
make[3]: Leaving directory '/tmp/gcc-12.2.0/gcc.build.lnx/gcc'
make[2]: *** [Makefile:5005: all-stage2-gcc] Error 2
make[2]: Leaving directory '/tmp/gcc-12.2.0/gcc.build.lnx'
make[1]: *** [Makefile:30918: stage2-bubble] Error 2
make[1]: Leaving directory '/tmp/gcc-12.2.0/gcc.build.lnx'
make: *** [Makefile:31130: bootstrap] Error 2

The offending file will be different each time, although it's always under d/.deps/. Additionally, sometimes the error message is *** target pattern contains no '%'. Stop.; sometimes it's *** missing separator. Stop..

If I go and inspect the offending file, I can see that the filename has been corrupted (notice the errant f2 3a fd 7f after opover.o and before the :):

00000000  64 2f 6f 70 6f 76 65 72  2e 6f f2 3a fd 7f 3a 20  |d/opover.o.:..: |
00000010  2e 2e 2f 2e 2e 2f 67 63  63 2f 64 2f 64 6d 64 2f  |../../gcc/d/dmd/|
00000020  6f 70 6f 76 65 72 2e 64  20 5c 0a 20 2f 74 6d 70  |opover.d \. /tmp|
00000030  2f 67 63 63 2d 31 32 2e  32 2e 30 2f 67 63 63 2f  |/gcc-12.2.0/gcc/|
00000040  64 2f 64 6d 64 2f 63 6c  6f 6e 65 2e 64 20 2f 74  |d/dmd/clone.d /t|

I don't see these extraneous characters in the output being spit out by make -- so I don't know where they're coming from.

I'm almost ready to call this a bug in GCC. But before I do, what else would cause this to happen?

0

There are 0 best solutions below