When compiling for ubuntu22.04 Linux 6.5.0-35 I received a gcc warning about mismatched compilers and an error about an unknown option like so:
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
CC [M] /home/ubuntu/Diamorphine/diamorphine.o
gcc: error: unrecognized command-line option ‘-ftrivial-auto-var-init=zero’
But I am confused since the error message states that we are already using gcc-12 and we would need to use x86_64-linux-gnu-gcc-12.
On my system it exists under /usr/bin/x86_64-linux-gnu-gcc-12 thus setting this as the standard gcc should be the solution.
This is weird.
Anyway maybe the hint that such an error may be resolved by playing around with update-alternatives is good information.
When compiling for ubuntu22.04 Linux 6.5.0-35 I received a gcc warning about mismatched compilers and an error about an unknown option like so:
Setting the standard
gcc
version to 12 solves it.It works.
But I am confused since the error message states that we are already using
gcc-12
and we would need to usex86_64-linux-gnu-gcc-12
. On my system it exists under/usr/bin/x86_64-linux-gnu-gcc-12
thus setting this as the standardgcc
should be the solution. This is weird.Anyway maybe the hint that such an error may be resolved by playing around with
update-alternatives
is good information.