I hadn't read this thread, so I fixed it myself, with this patch:
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -63,7 +63,7 @@
EXTRA_CFLAGS += -I$(src)/common/inc
EXTRA_CFLAGS += -I$(src)
-EXTRA_CFLAGS += -Wall -MD $(DEFINES) $(INCLUDES) -Wsign-compare -Wno-cast-qual -Wno-error
+EXTRA_CFLAGS += -Wall -MD $(DEFINES) $(INCLUDES) -Wsign-compare -Wno-cast-qual -Wno-error -fpermissive
EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"390.157\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -Wno-sign-compare -Wno-format-extra-args
EXTRA_CFLAGS += $(call cc-option,-Werror=undef,)
EXTRA_CFLAGS += -DNV_SPECTRE_V2=$(NV_SPECTRE_V2)
@@ -101,7 +101,9 @@
NV_CONFTEST_CMD := /bin/sh $(NV_CONFTEST_SCRIPT) \
"$(CC)" "$(HOST_CC)" $(ARCH) $(NV_KERNEL_SOURCES) $(NV_KERNEL_OUTPUT)
-NV_CONFTEST_CFLAGS := $(shell $(NV_CONFTEST_CMD) build_cflags)
+NV_CFLAGS_FROM_CONFTEST := $(shell $(NV_CONFTEST_CMD) build_cflags)
+
+NV_CONFTEST_CFLAGS = $(NV_CFLAGS_FROM_CONFTEST) $(EXTRA_CFLAGS) -fno-pie
NV_CONFTEST_COMPILE_TEST_HEADERS := $(obj)/conftest/macros.h
NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj)/conftest/functions.h
I think this is more proper, GCC itself recommends using -fpermissive if there is need for the legacy behavior: https://gcc.gnu.org/gcc-14/porting_to.html
The change about NV_CONFTEST_CFLAGS
I copied from the nvidia-470xx-utils
file. They are mostly identical, but this one were missing that extra bit that forwards the extra flags to the conftest
script.
Pinned Comments
jonathon commented on 2022-05-26 09:46 (UTC)
Please don't flag this package out-of-date unless a new version has been released by NVIDIA.
jonathon commented on 2021-12-26 22:44 (UTC) (edited on 2021-12-26 22:44 (UTC) by jonathon)
The DKMS package guidelines are explicit that
linux-headers
should not be a dependency of any DKMS package.As a concrete example of why including that as a hard dependency is a bad idea, what happens when
linux
is not an installed kernel?jonathon commented on 2020-10-19 12:41 (UTC) (edited on 2021-05-11 14:18 (UTC) by jonathon)
PACKAGE NEEDS LONG TERM MAINTAINER
I have adopted the 390xx packages to keep them secure. I do not run any 390xx hardware so will not notice any breakages and cannot test any changes.
Until such time as someone else steps up to maintain these packages - ideally someone who actually has 390xx hardware - I have to rely on you to tell me what changes are needed.
Don't expect a response if you post only "this doesn't work", and do not email me to complain about the package not working!
Use this forum thread for discussion: https://bbs.archlinux.org/viewtopic.php?pid=1946926
A binary package is also available in my kernel-lts unofficial user repository.