# error while compiling x11/nvidia-driver-390



## joshbsd (Dec 11, 2022)

I had this when trying to rebuild the driver:



```
usr/ports/x11/nvidia-driver-390 # make install clean
===>  Building for nvidia-driver-390-390.151
--- all_subdir_src ---
===> src (all)
--- all_subdir_src/nvidia ---
===> src/nvidia (all)
--- nvidia_os.o ---
--- nvidia_pci.o ---
--- nvidia_subr.o ---
--- nvidia_os.o ---
cc  -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"390.151\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -Wno-sign-compare -Wno-format-extra-args -UDEBUG -U_DEBUG -DNDEBUG -DNV_SPECTRE_V2=1 -DNV_KERNEL_INTERFACE_LAYER -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I../common/inc -include /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD  -MF.depend.nvidia_os.o -MTnvidia_os.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -c nvidia_os.c -o nvidia_os.o
--- nvidia_pci.o ---
cc  -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"390.151\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -Wno-sign-compare -Wno-format-extra-args -UDEBUG -U_DEBUG -DNDEBUG -DNV_SPECTRE_V2=1 -DNV_KERNEL_INTERFACE_LAYER -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I../common/inc -include /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD  -MF.depend.nvidia_pci.o -MTnvidia_pci.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -c nvidia_pci.c -o nvidia_pci.o
--- nvidia_subr.o ---
cc  -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"390.151\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -Wno-sign-compare -Wno-format-extra-args -UDEBUG -U_DEBUG -DNDEBUG -DNV_SPECTRE_V2=1 -DNV_KERNEL_INTERFACE_LAYER -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I../common/inc -include /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD  -MF.depend.nvidia_subr.o -MTnvidia_subr.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -c nvidia_subr.c -o nvidia_subr.o
--- nvidia_pci.o ---
nvidia_pci.c:446:84: error: too many arguments provided to function-like macro invocation
DRIVER_MODULE(nvidia, vgapci, nvidia_pci_driver, nvidia_devclass, nvidia_modevent, 0);
                                                                                   ^
/usr/src/sys/sys/bus.h:834:9: note: macro 'DRIVER_MODULE' defined here
#define DRIVER_MODULE(name, busname, driver, evh, arg)                  \
        ^
nvidia_pci.c:446:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
DRIVER_MODULE(nvidia, vgapci, nvidia_pci_driver, nvidia_devclass, nvidia_modevent, 0);
^
2 errors generated.
*** [nvidia_pci.o] Error code 1

make[4]: stopped in /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia
--- nvidia_os.o ---
nvidia_os.c:280:19: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
    pmap_unmapdev((vm_offset_t)address, size);
                  ^~~~~~~~~~~~~~~~~~~~
./machine/pmap.h:476:26: note: passing argument to parameter here
void    pmap_unmapdev(void *, vm_size_t);
                            ^
--- nvidia_subr.o ---
nvidia_subr.c:1133:13: error: incompatible pointer to integer conversion assigning to 'vm_offset_t' (aka 'unsigned long') from 'void *' [-Werror,-Wint-conversion]
    address = NV_KMEM_ALLOC_CONTIG(size, flags, 0,
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvidia_subr.c:1182:22: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
        NV_KMEM_FREE(at->pte_array[0].virtual_address, at->size);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./nv-freebsd.h:416:15: note: expanded from macro 'NV_KMEM_FREE'
    kmem_free(address, size)
              ^~~~~~~
/usr/src/sys/vm/vm_extern.h:73:22: note: passing argument to parameter 'addr' here
void kmem_free(void *addr, vm_size_t size);
                     ^
nvidia_subr.c:1208:18: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
    NV_KMEM_FREE(at->pte_array[0].virtual_address, at->size);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./nv-freebsd.h:416:15: note: expanded from macro 'NV_KMEM_FREE'
    kmem_free(address, size)
              ^~~~~~~
/usr/src/sys/vm/vm_extern.h:73:22: note: passing argument to parameter 'addr' here
void kmem_free(void *addr, vm_size_t size);
                     ^
--- nvidia_os.o ---
1 error generated.
--- nvidia_subr.o ---
nvidia_subr.c:1271:17: error: incompatible pointer to integer conversion assigning to 'vm_offset_t' (aka 'unsigned long') from 'void *' [-Werror,-Wint-conversion]
        address = NV_KMEM_ALLOC_CONTIG(PAGE_SIZE, flags, 0,
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvidia_subr.c:1325:22: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
        NV_KMEM_FREE(at->pte_array[i].virtual_address, PAGE_SIZE);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./nv-freebsd.h:416:15: note: expanded from macro 'NV_KMEM_FREE'
    kmem_free(address, size)
              ^~~~~~~
/usr/src/sys/vm/vm_extern.h:73:22: note: passing argument to parameter 'addr' here
void kmem_free(void *addr, vm_size_t size);
                     ^
nvidia_subr.c:1354:22: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
        NV_KMEM_FREE(at->pte_array[i].virtual_address, PAGE_SIZE);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./nv-freebsd.h:416:15: note: expanded from macro 'NV_KMEM_FREE'
    kmem_free(address, size)
              ^~~~~~~
/usr/src/sys/vm/vm_extern.h:73:22: note: passing argument to parameter 'addr' here
void kmem_free(void *addr, vm_size_t size);
                     ^
--- nvidia_os.o ---
*** [nvidia_os.o] Error code 1

make[4]: stopped in /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia
--- nvidia_subr.o ---
6 errors generated.
*** [nvidia_subr.o] Error code 1

make[4]: stopped in /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia
3 errors

make[4]: stopped in /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia

make[3]: stopped in /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src

make[2]: stopped in /usr/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/x11/nvidia-driver-390
*** Error code 1

Stop.
make: stopped in /usr/ports/x11/nvidia-driver-390
```

just before that I build the wrong driver, drm-kmod, but deinstalled it.
did this break the graphical environment I didn't reboot yet,
I also reinstalled it after that using `make deinstall clean` in the port directory and `pkg install` instead, but I want to make sure nothing I broke before restarting the machine.


----------



## joshbsd (Dec 11, 2022)

Nothing is broken. But I'm wandering why I get these errors.


----------



## W.hâ/t (Dec 11, 2022)

I see 2 possible reasons, ports tree is not up to date or/and you are running an unsuported version of FreeBSD.


----------



## joshbsd (Dec 11, 2022)

...I did `git -C /usr/ports pull` before `make install clean` I'm using 2022Q4 Tree branche on freebsd 13.1p5
In `/etc/pkg/Freebsd.conf` : url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",


----------



## W.hâ/t (Dec 11, 2022)

You may want to wait a bit, the problem is fixed on the main branch.


----------



## joshbsd (Dec 11, 2022)

just realised that in `dmesg` it says
FreeBSD 13.1-RELEASE-p3 GENERIC amd64 at boot
but `neofetch` says :
OS: FreeBSD 13.1-RELEASE-p5 amd64
and kinfo :
Kernel Version: 13.1-RELEASE-p3 (64-bit)

and `freebsd-update fetch` :
No updates needed to update system to 13.1-RELEASE-p5.
`uname -r`: 
13.1-RELEASE-p3


----------



## Alain De Vos (Dec 11, 2022)

```
freebsd-version -kru
```


----------



## joshbsd (Dec 11, 2022)

`freebsd-version -kru`

```
13.1-RELEASE-p3
13.1-RELEASE-p3
13.1-RELEASE-p5
```

-u          Print the version and patch level of the installed userland.
                 These are hardcoded into freebsd-version during the build.

???


----------



## Alain De Vos (Dec 11, 2022)

I think there where patches in userland & not in kernel or vice-versa. So that output looks ok for me.


----------



## joshbsd (Dec 11, 2022)

I see. was wandering what userland mean; so the userland is part 5 and the kernel part 3.
found the answer there : https://forums.FreeBSD.org/threads/what-is-userland.57354/post-326926


----------



## Alain De Vos (Dec 11, 2022)

Yes.


----------

