Welcome to SparkyLinux forums
Zapraszamy również na polsko-języczne Forum https://forum.linuxiarze.pl

[closed] XanMod kernel + NVidia = CC mismatch error

Started by k410, October 18, 2022, 04:43:25 PM

Previous topic - Next topic

k410

Recently I have been trying to install the xanmod stable kernel just to see what difference it makes.

I have an NVidia GTX 1060 video card, and the nvidia-driver (470) works well with that.

However, when I try to install xanmod stable through APTus, after "Building modules" I get an error message that says to check /var/lib/dkms/nvidia-current/470.141.03/build/make.log .

From the make.log:
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-12 (Debian 12.2.0-3) 12.2.0
  You are using:           gcc (Debian 12.2.0-3) 12.2.0

It also seems the ".ko" files don't get built and installed (I don't see the usual messages related to those during the process).

I have tried these with no luck:
export CC=gcc-12
export IGNORE_CC_MISMATCH=1
(in my .bashrc -- but maybe that's the wrong place to set them?)

Is it just a matter of setting the right environment variables in the right place?

Or is there a correct sequence of steps for installation, e.g., first remove nvidia-driver and nvidia-kernel-dkms, then install xanmod stable (through APTus), reboot, then reinstall nvidia-driver (which would also install nvidia-kernel-dkms as a dependency)?

Thanks for your help!

(BTW, this is not urgent. I'm just exploring. The default kernel 5.19 works fine on my system.)

k410

#1
More info: Using "apt show nvidia-driver" I learned that for driver version 470, "Building the kernel module has been tested up to Linux 5.19," and the XanMod kernel I was trying to install was in the 6.0 kernel series, so I thought maybe the CC mismatch might not be the reason preventing the Nvidia modules from being built.

So, from a terminal I tried installing one of the 5.19 series xanmod kernels. There was a similar warning about a difference in compilers, so I removed that kernel and tried again like this:

$ su -
# CC=gcc-11
# apt install linux-headers-5.19.15-xanmod1 linux-image-5.19.15-xanmod1

but module building still failed. Here is the whole make.log for that attempt:

DKMS make.log for nvidia-current-470.141.03 for kernel 5.19.15-xanmod1 (x86_64)
Wed Oct 19 09:14:15 AM EDT 2022
make V=1 -C /lib/modules/5.19.15-xanmod1/build M=/var/lib/dkms/nvidia-current/470.141.03/build ARCH=x86_64 NV_KERNEL_SOURCES=/lib/modules/5.19.15-xanmod1/build NV_KERNEL_OUTPUT=/lib/modules/5.19.15-xanmod1/build NV_KERNEL_MODULES="nvidia nvidia-uvm nvidia-modeset nvidia-drm nvidia-peermem" INSTALL_MOD_DIR=kernel/drivers/video NV_SPECTRE_V2=0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.19.15-xanmod1'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 "  ERROR: Kernel configuration is invalid."; \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.2.0-12) 11.2.0
  You are using:           gcc (Debian 12.2.0-3) 12.2.0
make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia-current/470.141.03/build \
single-build= \
need-builtin=1 need-modorder=1
NV_CONFTEST_CMD=/bin/sh /var/lib/dkms/nvidia-current/470.141.03/build/conftest.sh "gcc" x86_64 /lib/modules/5.19.15-xanmod1/build /lib/modules/5.19.15-xanmod1/build
NV_CONFTEST_CFLAGS=-O2 -D__KERNEL__ -DKBUILD_BASENAME="#conftest35674" -DKBUILD_MODNAME="#conftest35674" -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/12/include -I/lib/modules/5.19.15-xanmod1/build/arch/x86/include/asm/mach-default -I/lib/modules/5.19.15-xanmod1/build/include/asm-x86/mach-default -include /lib/modules/5.19.15-xanmod1/build/include/generated/autoconf.h -I/lib/modules/5.19.15-xanmod1/build/arch/x86/include -I/lib/modules/5.19.15-xanmod1/build/arch/x86/include/uapi -I/lib/modules/5.19.15-xanmod1/build/arch/x86/include/generated -I/lib/modules/5.19.15-xanmod1/build/arch/x86/include/generated/uapi -I/lib/modules/5.19.15-xanmod1/build/include -I/lib/modules/5.19.15-xanmod1/build/include/uapi -I/lib/modules/5.19.15-xanmod1/build/include/xen -I/lib/modules/5.19.15-xanmod1/build/include/generated/uapi -mfentry -DCC_USING_FENTRY -I/var/lib/dkms/nvidia-current/470.141.03/build/common/inc -I/var/lib/dkms/nvidia-current/470.141.03/build -Wall -MD   -Wno-cast-qual -Wno-error -Wno-format-extra-args -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"470.141.03\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -Werror=undef -DNV_SPECTRE_V2=0 -DNV_KERNEL_INTERFACE_LAYER -fno-pie -Wall -Wundef -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-avx2 -mno-avx512f -O3 -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -mtune=generic -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -fomit-frame-pointer -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-tree-vectorize -fno-strict-overflow -fno-stack-check -fconserve-stack -Wno-packed-not-aligned
KBUILD_CFLAGS=-Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-avx2 -mno-avx512f -O3 -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -mtune=generic -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong  -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -fomit-frame-pointer  -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign  -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than  -fno-tree-vectorize -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned
LINUXINCLUDE=-I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h
LDFLAGS=
KBUILD_LDFLAGS=-m elf_x86_64 -z noexecstack --no-warn-rwx-segments
  printf '%s
'   nvidia/nv.o nvidia/nv-pci.o nvidia/nv-acpi.o nvidia/nv-cray.o nvidia/nv-dma.o nvidia/nv-i2c.o nvidia/nv-mmap.o nvidia/nv-p2p.o nvidia/nv-pat.o nvidia/nv-procfs.o nvidia/nv-procfs-utils.o nvidia/nv-usermap.o nvidia/nv-vm.o nvidia/nv-vtophys.o nvidia/os-interface.o nvidia/os-mlock.o nvidia/os-pci.o nvidia/os-registry.o nvidia/os-usermap.o nvidia/nv-modeset-interface.o nvidia/nv-pci-table.o nvidia/nv-kthread-q.o nvidia/nv-memdbg.o nvidia/nv-ibmnpu.o nvidia/nv-report-err.o nvidia/nv-rsync.o nvidia/nv-msi.o nvidia/nv-caps.o nvidia/nv-frontend.o nvidia/nv_uvm_interface.o nvidia/nvlink_linux.o nvidia/nvlink_caps.o nvidia/linux_nvswitch.o nvidia/procfs_nvswitch.o nvidia/i2c_nvswitch.o nvidia/nv-kernel.o | awk '!x[$0]++ { print("/var/lib/dkms/nvidia-current/470.141.03/build/"$0) }' > /var/lib/dkms/nvidia-current/470.141.03/build/nvidia.mod
ARCH=x86_64

Compiler version check failed:

The major and minor number of the compiler used to
compile the kernel:

gcc-11 (Debian 11.2.0-12) 11.2.0, GNU ld (GNU Binutils for Debian) 2.37

does not match the compiler used here:

gcc (Debian 12.2.0-3) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


It is recommended to set the CC environment variable
to the compiler that was used to compile the kernel.

The compiler version check can be disabled by setting
the IGNORE_CC_MISMATCH environment variable to "1".
However, mixing compiler versions between the kernel
and kernel modules can result in subtle bugs that are
difficult to diagnose.

*** Failed CC version check. Bailing out! ***

make[2]: *** [/var/lib/dkms/nvidia-current/470.141.03/build/Kbuild:216: cc_version_check] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1979: /var/lib/dkms/nvidia-current/470.141.03/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.19.15-xanmod1'
make: *** [Makefile:80: modules] Error 2

Here is the make.log from trying to install XanMod LTS through APTus AppCenter:

DKMS make.log for nvidia-current-470.141.03 for kernel 5.15.72-xanmod1 (x86_64)
Wed Oct 19 09:34:04 AM EDT 2022
make V=1 -C /lib/modules/5.15.72-xanmod1/build M=/var/lib/dkms/nvidia-current/470.141.03/build ARCH=x86_64 NV_KERNEL_SOURCES=/lib/modules/5.15.72-xanmod1/build NV_KERNEL_OUTPUT=/lib/modules/5.15.72-xanmod1/build NV_KERNEL_MODULES="nvidia nvidia-uvm nvidia-modeset nvidia-drm nvidia-peermem" INSTALL_MOD_DIR=kernel/drivers/video NV_SPECTRE_V2=0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.72-xanmod1'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 "  ERROR: Kernel configuration is invalid."; \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.2.0-12) 11.2.0
  You are using:           gcc (Debian 12.2.0-3) 12.2.0
make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia-current/470.141.03/build \
single-build= \
need-builtin=1 need-modorder=1
NV_CONFTEST_CMD=/bin/sh /var/lib/dkms/nvidia-current/470.141.03/build/conftest.sh "gcc" x86_64 /lib/modules/5.15.72-xanmod1/build /lib/modules/5.15.72-xanmod1/build
NV_CONFTEST_CFLAGS=-O2 -D__KERNEL__ -DKBUILD_BASENAME="#conftest53097" -DKBUILD_MODNAME="#conftest53097" -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/12/include -I/lib/modules/5.15.72-xanmod1/build/arch/x86/include/asm/mach-default -I/lib/modules/5.15.72-xanmod1/build/include/asm-x86/mach-default -include /lib/modules/5.15.72-xanmod1/build/include/generated/autoconf.h -I/lib/modules/5.15.72-xanmod1/build/arch/x86/include -I/lib/modules/5.15.72-xanmod1/build/arch/x86/include/uapi -I/lib/modules/5.15.72-xanmod1/build/arch/x86/include/generated -I/lib/modules/5.15.72-xanmod1/build/arch/x86/include/generated/uapi -I/lib/modules/5.15.72-xanmod1/build/include -I/lib/modules/5.15.72-xanmod1/build/include/uapi -I/lib/modules/5.15.72-xanmod1/build/include/xen -I/lib/modules/5.15.72-xanmod1/build/include/generated/uapi -mfentry -DCC_USING_FENTRY -I/var/lib/dkms/nvidia-current/470.141.03/build/common/inc -I/var/lib/dkms/nvidia-current/470.141.03/build -Wall -MD   -Wno-cast-qual -Wno-error -Wno-format-extra-args -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"470.141.03\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -Werror=undef -DNV_SPECTRE_V2=0 -DNV_KERNEL_INTERFACE_LAYER -fno-pie -Wall -Wundef -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-avx2 -mno-avx512f -mpopcnt -O3 -fno-tree-vectorize -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -fomit-frame-pointer -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Wno-packed-not-aligned
KBUILD_CFLAGS=-Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-avx2 -mno-avx512f -mpopcnt -O3  -fno-tree-vectorize -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -fomit-frame-pointer  -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned
LINUXINCLUDE=-I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h
LDFLAGS=

Compiler version check failed:

The major and minor number of the compiler used to
compile the kernel:

gcc-11 (Debian 11.2.0-12) 11.2.0, GNU ld (GNU Binutils for Debian) 2.37

does not match the compiler used here:

gcc (Debian 12.2.0-3) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


It is recommended to set the CC environment variable
to the compiler that was used to compile the kernel.

The compiler version check can be disabled by setting
the IGNORE_CC_MISMATCH environment variable to "1".
However, mixing compiler versions between the kernel
and kernel modules can result in subtle bugs that are
difficult to diagnose.

*** Failed CC version check. Bailing out! ***

make[2]: *** [/var/lib/dkms/nvidia-current/470.141.03/build/Kbuild:216: cc_version_check] Error 1
make[2]: *** Waiting for unfinished jobs....
KBUILD_LDFLAGS=-m elf_x86_64 -z noexecstack --no-warn-rwx-segments
ARCH=x86_64
make[1]: *** [Makefile:1899: /var/lib/dkms/nvidia-current/470.141.03/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.72-xanmod1'
make: *** [Makefile:80: modules] Error 2

In both cases the make.log says:  *** Failed CC version check. Bailing out! ***

So if I can learn how to set or export the right variable the right way so that the system uses the right compiler and also "believes" it is using the right compiler, maybe the Nvidia modules would be built?

-----
Side notes:
Meanwhile, last night (Florida time) I installed the Liquorix kernel through APTus, which built the Nvidia modules with no problems, and I am using that kernel as I type.
Of course I am also thinking of getting an AMD GPU or APU next time I put money into hardware upgrades. ;-)

k410

Meanwhile, the situation has changed. A few days ago, nvidia-driver was successfully updated to 510 (from 470). Today I was able to install linux-xanmod from the command line, and the Nvidia modules were built and installed with no problems.

I'm marking this "closed" instead of "solved" because it would still be good to learn the correct way to deal with this kind of compiler-mismatch problem (described in the first two posts) in case it happens again.

View the most recent posts on the forum