FreeBSD Build Errors v495.xx & 510.xx

Noted a common build failure in recent driver package releases.
This happens for FreeBSD 13.0-RELEASE / FreeBSD 13-STABLE / FreeBSD 14-CURRENT, and the driver version series as noted in the Subject line of this post.

" # make "

" In file included from nvidia-modeset-freebsd.c:12:
/usr/src/sys/sys/module.h:262:13: error: use of undeclared identifier ‘MAXPATHLEN’ "

The fix is easy. Edit the file:
" .src/nvidia-modeset-freebsd.c "

Find the line that says:
" #include <sys/module.h> "

And move this ^^^ line, well below the line that says:
" #include <sys/param.h> "

Save the modifications & compile. I’ve tested this on multiple different machines & compilation succeeds without issue.
I’d advise the NVidia dev team to include this simple fix as-is. One could opt for a more involved and complex set of checks & #ifdefs to the Makefile, but honestly, that’s just unnecessary work for no discernible practical reason.

Thanks for your continued FreeBSD support to all!

The problem persists in the most recent driver release: NVIDIA-FreeBSD-x86_64-510.54.tar.xz

Again, the fix is simple:

Edit the file:

Literally move the line:
#include <sys/module.h>

And place it right below the line:
#include <sys/param.h>

Save & make.

Why hasn’t this been addressed yet?