NVIDIA – GCC15 on Fedora 42 Wrecks Compilation – and a Workaround..
Recently updated the test system to Fedora 42, and everything seemed OK (including the latest VMware Workstation) – except the NVIDIA driver install..
The latest driver 570.124.04 compiles and installs OK with GCC14 and Fedora 41, on 6.13.x and also 6.14-rc kernels, but the NVIDIA source install scripts/tests etc. seem to be completely useless when compiling under GCC 15 with Fedora 42, with a compiled kernel.org kernel, but do compile/install successfully when using the Distro-supplied Fedora 42 version of the kernel (6.14.0-0.rc6.49.fc42.x86_64 rpm)….
I had thought that this might be due to an additional kernel compile selection/option being necessary, similar to the Kernel 6.12 issues, so I tried compiling the kernel using the Fedora version of the kernel config (from /usr/src/kernels/6.14.0-0.rc6.49.fc42.x86_64/config ) with ‘almost everything selected’, but the problem still occurred, so I can only assume that the Fedora-supplied kernel has some proprietary patch applied (as usual) which fixes the issue?
...................
CONFTEST: drm_alpha_blending_available
CONFTEST: is_export_symbol_present_drm_gem_prime_fd_to_handle
CONFTEST: is_export_symbol_present_drm_gem_prime_handle_to_fd
CONFTEST: ib_peer_memory_symbols
CC [M] nvidia/nv.o
In file included from ././common/inc/conftest.h:28,
from ././common/inc/nv_stdarg.h:29,
from ././common/inc/os-interface.h:40,
from nvidia/nv.c:33:
././conftest/functions.h:75:2: error: #error dma_buf_export() conftest failed!
75 | #error dma_buf_export() conftest failed!
| ^~~~~
././conftest/functions.h:91:2: error: #error radix_tree_replace_slot() conftest failed!
91 | #error radix_tree_replace_slot() conftest failed!
| ^~~~~
In file included from ././common/inc/nv-linux.h:34,
from nvidia/nv.c:34:
././common/inc/nv-mm.h:29:13: error: conflicting types for ‘vm_fault_t’; have ‘int’
29 | typedef int vm_fault_t;
| ^~~~~~~~~~
In file included from /usr/src/linux-6.13.7/include/linux/mmzone.h:22,
from /usr/src/linux-6.13.7/include/linux/gfp.h:7,
from /usr/src/linux-6.13.7/include/linux/umh.h:4,
from /usr/src/linux-6.13.7/include/linux/kmod.h:9,
from /usr/src/linux-6.13.7/include/linux/module.h:17,
from nvidia/nv.c:24:
/usr/src/linux-6.13.7/include/linux/mm_types.h:1306:32: note: previous declaration of ‘vm_fault_t’ with type ‘vm_fault_t’ {aka ‘unsigned int’}
1306 | typedef __bitwise unsigned int vm_fault_t;
| ^~~~~~~~~~
In file included from /usr/src/linux-6.13.7/arch/x86/include/asm/processor.h:17,
from /usr/src/linux-6.13.7/arch/x86/include/asm/timex.h:5,
from /usr/src/linux-6.13.7/include/linux/timex.h:67,
from /usr/src/linux-6.13.7/include/linux/time32.h:13,
from /usr/src/linux-6.13.7/include/linux/time.h:60,
from /usr/src/linux-6.13.7/include/linux/stat.h:19,
from /usr/src/linux-6.13.7/include/linux/module.h:13:
././common/inc/nv-mm.h: In function ‘NV_GET_USER_PAGES’:
/usr/src/linux-6.13.7/arch/x86/include/asm/current.h:52:17: error: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
52 | #define current get_current()
| ^~~~~~~~~~~~~
| |
| struct task_struct *
././common/inc/nv-mm.h:112:31: note: in expansion of macro ‘current’
112 | return get_user_pages(current, current->mm, start, nr_pages, write,
| ^~~~~~~
In file included from ././common/inc/nv-pgprot.h:30,
from ././common/inc/nv-linux.h:33:
/usr/src/linux-6.13.7/include/linux/mm.h:2527:35: note: expected ‘long unsigned int’ but argument is of type ‘struct task_struct *’
2527 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ~~~~~~~~~~~~~~^~~~~
././common/inc/nv-mm.h:112:47: error: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
112 | return get_user_pages(current, current->mm, start, nr_pages, write,
/usr/src/linux-6.13.7/include/linux/mm.h:2527:56: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
2527 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ~~~~~~~~~~~~~~^~~~~~~~
././common/inc/nv-mm.h:112:60: error: passing argument 4 of ‘get_user_pages’ makes pointer from integer without a cast [-Wint-conversion]
112 | return get_user_pages(current, current->mm, start, nr_pages, write,
| ^~~~~~~~
| |
| long unsigned int
/usr/src/linux-6.13.7/include/linux/mm.h:2528:59: note: expected ‘struct page **’ but argument is of type ‘long unsigned int’
2528 | unsigned int gup_flags, struct page **pages);
| ~~~~~~~~~~~~~~^~~~~
././common/inc/nv-mm.h:112:16: error: too many arguments to function ‘get_user_pages’; expected 4, have 8
112 | return get_user_pages(current, current->mm, start, nr_pages, write,
| ^~~~~~~~~~~~~~ ~~~~~
/usr/src/linux-6.13.7/include/linux/mm.h:2527:6: note: declared here
2527 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ^~~~~~~~~~~~~~
In file included from /usr/src/linux-6.13.7/include/uapi/linux/posix_types.h:5,
from /usr/src/linux-6.13.7/include/uapi/linux/types.h:14,
from /usr/src/linux-6.13.7/include/linux/types.h:6,
from /usr/src/linux-6.13.7/include/linux/kasan-checks.h:5,
from /usr/src/linux-6.13.7/include/asm-generic/rwonce.h:26,
from /usr/src/linux-6.13.7/arch/x86/include/generated/asm/rwonce.h:1,
from /usr/src/linux-6.13.7/include/linux/compiler.h:316,
from /usr/src/linux-6.13.7/include/linux/build_bug.h:5,
from /usr/src/linux-6.13.7/include/linux/container_of.h:5,
from /usr/src/linux-6.13.7/include/linux/list.h:5,
from /usr/src/linux-6.13.7/include/linux/module.h:12:
././common/inc/nv-mm.h: In function ‘NV_GET_USER_PAGES_REMOTE’:
/usr/src/linux-6.13.7/include/linux/stddef.h:8:14: error: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
8 | #define NULL ((void *)0)
| ^~~~~~~~~~~
| |
| void *
././common/inc/nv-mm.h:218:35: note: in expansion of macro ‘NULL’
218 | return get_user_pages(NULL, mm, start, nr_pages, write, force, pages, NULL);
| ^~~~
/usr/src/linux-6.13.7/include/linux/mm.h:2527:35: note: expected ‘long unsigned int’ but argument is of type ‘void *’
2527 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ~~~~~~~~~~~~~~^~~~~
././common/inc/nv-mm.h:218:41: error: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
218 | return get_user_pages(NULL, mm, start, nr_pages, write, force, pages, NULL);
| ^~
| |
| struct mm_struct *
/usr/src/linux-6.13.7/include/linux/mm.h:2527:56: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
2527 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ~~~~~~~~~~~~~~^~~~~~~~
././common/inc/nv-mm.h:218:52: error: passing argument 4 of ‘get_user_pages’ makes pointer from integer without a cast [-Wint-conversion]
218 | return get_user_pages(NULL, mm, start, nr_pages, write, force, pages, NULL);
| ^~~~~~~~
| |
| long unsigned int
/usr/src/linux-6.13.7/include/linux/mm.h:2528:59: note: expected ‘struct page **’ but argument is of type ‘long unsigned int’
2528 | unsigned int gup_flags, struct page **pages);
| ~~~~~~~~~~~~~~^~~~~
././common/inc/nv-mm.h:218:20: error: too many arguments to function ‘get_user_pages’; expected 4, have 8
218 | return get_user_pages(NULL, mm, start, nr_pages, write, force, pages, NULL);
| ^~~~~~~~~~~~~~ ~~~~~
/usr/src/linux-6.13.7/include/linux/mm.h:2527:6: note: declared here
2527 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ^~~~~~~~~~~~~~
././common/inc/nv-mm.h: In function ‘nv_page_fault_va’:
././common/inc/nv-mm.h:242:33: error: ‘struct vm_fault’ has no member named ‘virtual_address’; did you mean ‘real_address’?
242 | return (unsigned long)(vmf->virtual_address);
| ^~~~~~~~~~~~~~~
| real_address
././common/inc/nv-mm.h: In function ‘nv_mmap_read_lock’:
././common/inc/nv-mm.h:251:20: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
251 | down_read(&mm->mmap_sem);
| ^~~~~~~~
| mmap_base
././common/inc/nv-mm.h: In function ‘nv_mmap_read_unlock’:
././common/inc/nv-mm.h:260:18: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
260 | up_read(&mm->mmap_sem);
| ^~~~~~~~
| mmap_base
././common/inc/nv-mm.h: In function ‘nv_mmap_write_lock’:
././common/inc/nv-mm.h:269:21: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
269 | down_write(&mm->mmap_sem);
| ^~~~~~~~
| mmap_base
././common/inc/nv-mm.h: In function ‘nv_mmap_write_unlock’:
././common/inc/nv-mm.h:278:19: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
278 | up_write(&mm->mmap_sem);
| ^~~~~~~~
| mmap_base
././common/inc/nv-mm.h: In function ‘nv_mm_rwsem_is_locked’:
././common/inc/nv-mm.h:287:33: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
287 | return rwsem_is_locked(&mm->mmap_sem);
| ^~~~~~~~
| mmap_base
././common/inc/nv-mm.h: In function ‘nv_mmap_get_lock’:
././common/inc/nv-mm.h:296:17: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
296 | return &mm->mmap_sem;
| ^~~~~~~~
| mmap_base
././common/inc/nv-mm.h: In function ‘nv_vm_flags_set’:
././common/inc/nv-mm.h:305:19: error: assignment of read-only member ‘vm_flags’
305 | vma->vm_flags |= flags;
| ^~
././common/inc/nv-mm.h: In function ‘nv_vm_flags_clear’:
././common/inc/nv-mm.h:314:19: error: assignment of read-only member ‘vm_flags’
314 | vma->vm_flags &= ~flags;
| ^~
In file included from ././common/inc/nv-linux.h:37:
././common/inc/nv-time.h: At top level:
././common/inc/nv-time.h:40:8: error: redefinition of ‘struct timespec64’
……………………….
<< followed by many more errors.. >>
So, the only solutions seemed to be.. 1. Stay with Fedora 41 for the time being, or 2. Use only the Distro-supplied kernel on Fedora 42..
Fortunately, I did find another option, which is best if you had already updated to Fedora 42… There is a GCC 14 available for Fedora 42, at https://packages.fedoraproject.org/pkgs/gcc14/gcc14/ This results in binaries with a ‘-14’ suffix (/usr/bin/gcc-14, /usr/bin/cpp-14, etc..)
Obviously this means you would be compiling the driver with a different GCC version from the kernel, but this is possible, as follows:
in ~/NVIDIA-Linux-x86_64-570.124.04/kernel:
# export IGNORE_CC_MISMATCH=1
# CC="gcc-14" make
make[1]: Entering directory '/usr/src/linux-6.13.7'
make[2]: Entering directory '/home/rgadsdon/NVIDIA-Linux-x86_64-570.124.04/kernel'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (GCC) 15.0.1 20250228 (Red Hat 15.0.1-0)
You are using: gcc-14 (GCC) 14.2.1 20250210 (Red Hat 14.2.1-8)
…………………………….
Then after compile completes successfully (but still with the usual ‘warnings’, as expected..)
…………………………..
In file included from /usr/src/linux-6.13.7/include/linux/compat.h:17,
from /usr/src/linux-6.13.7/arch/x86/include/asm/ia32.h:7,
from /usr/src/linux-6.13.7/arch/x86/include/asm/elf.h:10,
from /usr/src/linux-6.13.7/include/linux/elf.h:6,
from /usr/src/linux-6.13.7/include/linux/module.h:19,
from nvidia-drm.mod.c:1:
/usr/src/linux-6.13.7/include/linux/fs.h:1079:9: warning: ‘counted_by’ attribute directive ignored [-Wattributes]
1079 | unsigned char f_handle[] __counted_by(handle_bytes);
| ^~~~~~~~
LD [M] nvidia-drm.ko
CC [M] nvidia-peermem.mod.o
In file included from /usr/src/linux-6.13.7/include/linux/compat.h:17,
from /usr/src/linux-6.13.7/arch/x86/include/asm/ia32.h:7,
from /usr/src/linux-6.13.7/arch/x86/include/asm/elf.h:10,
from /usr/src/linux-6.13.7/include/linux/elf.h:6,
from /usr/src/linux-6.13.7/include/linux/module.h:19,
from nvidia-peermem.mod.c:1:
/usr/src/linux-6.13.7/include/linux/fs.h:1079:9: warning: ‘counted_by’ attribute directive ignored [-Wattributes]
1079 | unsigned char f_handle[] __counted_by(handle_bytes);
| ^~~~~~~~
LD [M] nvidia-peermem.ko
make[2]: Leaving directory '/home/rgadsdon/NVIDIA-Linux-x86_64-570.124.04/kernel'
make[1]: Leaving directory '/usr/src/linux-6.13.7'
<as root>
# make modules_install
# modprobe nvidia-drm (which pulls in the other modules..)
nvidia_uvm 1900544 2
nvidia_drm 122880 31
nvidia_modeset 1515520 99 nvidia_drm
nvidia 89751552 1156 nvidia_uvm,nvidia_modeset
drm_ttm_helper 12288 2 nvidia_drm
drm_client_lib 12288 1 nvidia_drm
drm_kms_helper 172032 3 drm_ttm_helper,nvidia_drm,drm_client_lib
drm 577536 38 drm_kms_helper,nvidia,drm_ttm_helper,nvidia_drm,drm_client_lib,ttm
then get the userland portion installed, ignoring the kernel..
# ./NVIDIA-Linux-x86_64-570.124.04.run -s –no-kernel-module
I have tested this with KDE/Plasma, and VMware 17.6.3 with Win10 guest, and – so far – everything seems to be working OK…
Of course, this is not intended for a business-critical setup!
Robert Gadsdon. March 14th 2025..
Comments
NVIDIA – GCC15 on Fedora 42 Wrecks Compilation – and a Workaround.. — No Comments