I ran into a situation where I'm unable to compile C code via cc if $CC is gcc-11 or gcc-13, though it works if I use env CC=gcc-9 and, of course, with CC set to any variant of clang. All three gcc toolchains were installed via apt under Ubuntu 23.10.
The actual command executed by the compiler:
[fish 0.1.0] error occurred: Command "sccache" "gcc-13" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "/mnt/d/rand/fish/target/debug/build/fish-1dce6c150ef9f00d/out" "-o" "/mnt/d/rand/fish/target/debug/build/fish-1dce6c150ef9f00d/out/2e40c9e35e9506f4-libc.o" "-c" "src/libc.c" with args gcc-13 did not execute successfully (status code exit status: 1).
[fish 0.1.0]
[fish 0.1.0]
The following warnings were emitted during compilation:
warning: fish@0.1.0: as: unrecognized option '--gdwarf-4'
The interesting thing is that gcc-9 -dumpspecs | grep gdwarf prints only gdwarf2 support, but both gcc-11 and gcc-13 show support for up to gdwarf5:
so if anything, I would have expected gcc-9 to be the one that doesn't support it, but the problem is with as:
> as --gdwarf-4
as: unrecognized option '--gdwarf-4'
-gdwarf-4 was introduced in 0fff25ae9aebfc0635e8b2ac719fda4047b4e252 (cc 1.0.77+), with the rationale that this would cause the compiler to match the compiler format rust is using, but I think this doesn't account for the fact that rust could be using an entirely different assembler/toolchain than what C code executed by build.rs uses.
I ran into a situation where I'm unable to compile C code via
cc
if$CC
isgcc-11
orgcc-13
, though it works if I useenv CC=gcc-9
and, of course, withCC
set to any variant ofclang
. All three gcc toolchains were installed viaapt
under Ubuntu 23.10.The actual command executed by the compiler:
The interesting thing is that
gcc-9 -dumpspecs | grep gdwarf
prints only gdwarf2 support, but bothgcc-11
andgcc-13
show support for up to gdwarf5:so if anything, I would have expected
gcc-9
to be the one that doesn't support it, but the problem is withas
:-gdwarf-4
was introduced in 0fff25ae9aebfc0635e8b2ac719fda4047b4e252 (cc 1.0.77+), with the rationale that this would cause the compiler to match the compiler format rust is using, but I think this doesn't account for the fact that rust could be using an entirely different assembler/toolchain than what C code executed bybuild.rs
uses.