Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 870238 - x11-drivers/nvidia-drivers-515.65.01: Fails to compile with clang-15
Summary: x11-drivers/nvidia-drivers-515.65.01: Fails to compile with clang-15
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Ionen Wolkens
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2022-09-15 14:58 UTC by Manuel Nickschas
Modified: 2022-09-16 06:15 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log.xz,8.06 KB, application/x-xz)
2022-09-15 14:59 UTC, Manuel Nickschas
Details
emerge --info (emerge.info.xz,6.82 KB, application/x-xz)
2022-09-15 15:00 UTC, Manuel Nickschas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Nickschas 2022-09-15 14:58:20 UTC
Building nvidia-drivers against a clang-built kernel fails with clang-15:

--------8<---------------------------------------------------------

/var/tmp/portage/x11-drivers/nvidia-drivers-515.65.01/work/kernel/nvidia/os-interface.c:1091:36: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
NvU32 NV_API_CALL os_get_cpu_number()
                                   ^
                                    void
/var/tmp/portage/x11-drivers/nvidia-drivers-515.65.01/work/kernel/nvidia/os-interface.c:1098:35: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
NvU32 NV_API_CALL os_get_cpu_count()
                                  ^
                                   void
/var/tmp/portage/x11-drivers/nvidia-drivers-515.65.01/work/kernel/nvidia/os-interface.c:1151:31: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void NV_API_CALL os_dump_stack()
                              ^
                               void
/var/tmp/portage/x11-drivers/nvidia-drivers-515.65.01/work/kernel/nvidia/os-interface.c:1291:11: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
    panic(bugCodeStr);
          ^~~~~~~~~~
/var/tmp/portage/x11-drivers/nvidia-drivers-515.65.01/work/kernel/nvidia/os-interface.c:1291:11: note: treat the string as an argument to avoid this
    panic(bugCodeStr);
          ^
          "%s", 
1 warning and 3 errors generated.
make[2]: *** [scripts/Makefile.build:249: /var/tmp/portage/x11-drivers/nvidia-drivers-515.65.01/work/kernel/nvidia/os-interface.o] Error 1

--------8<---------------------------------------------------------

This is most likely caused by one of the controversially discussed changes in clang-15 turning several warnings into errors, in this case -Wstrict-prototypes.

My setup works fine with clang-14.

Reproducible: Always

Steps to Reproduce:
1. Build kernel with Clang-15 (CC=clang LLVM=1 LLVM_IAS=1)
2. Try to build nvidia-drivers with system-wide Clang-15
3. Profit
Actual Results:  
Cmopilation fails

Expected Results:  
Compilation should not fail
Comment 1 Manuel Nickschas 2022-09-15 14:59:43 UTC
Created attachment 805357 [details]
build.log
Comment 2 Manuel Nickschas 2022-09-15 15:00:00 UTC
Created attachment 805360 [details]
emerge --info
Comment 3 Manuel Nickschas 2022-09-15 16:32:47 UTC
One more note: This was already using clang-15.0.1, i.e. including the emergency fixes for some of the other warnings, but that doesn't apparently cover -Wstrict-prototypes.
Comment 4 Larry the Git Cow gentoo-dev 2022-09-16 06:15:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1b84c5ad27be16032ac596f0cad88869b3c1741

commit e1b84c5ad27be16032ac596f0cad88869b3c1741
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2022-09-16 05:14:10 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2022-09-16 06:05:35 +0000

    x11-drivers/nvidia-drivers: fix building modules with clang15
    
    Closes: https://bugs.gentoo.org/870238
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 .../files/nvidia-drivers-390.154-clang15.patch     |  81 ++++++++++++++++
 .../files/nvidia-drivers-470.141.03-clang15.patch  | 107 +++++++++++++++++++++
 .../nvidia-drivers/nvidia-drivers-390.154.ebuild   |   1 +
 .../nvidia-drivers-470.141.03.ebuild               |   1 +
 .../nvidia-drivers/nvidia-drivers-510.85.02.ebuild |   1 +
 .../nvidia-drivers/nvidia-drivers-515.49.15.ebuild |   4 +
 .../nvidia-drivers/nvidia-drivers-515.65.01.ebuild |   4 +
 7 files changed, 199 insertions(+)