Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 888587 - x11-drivers/nvidia-drivers fails to build with clang when kernel was built with gcc
Summary: x11-drivers/nvidia-drivers fails to build with clang when kernel was built wi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal minor (vote)
Assignee: Ionen Wolkens
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-27 01:33 UTC by acertig04
Modified: 2022-12-27 11:14 UTC (History)
2 users (show)

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


Attachments
config.log from nvidia-drivers (config.log,37.11 KB, text/x-log)
2022-12-27 01:33 UTC, acertig04
Details

Note You need to log in before you can comment on or make changes to this bug.
Description acertig04 2022-12-27 01:33:00 UTC
Because nvidia-drivers pulls some flags from the kernel config, when building with different toolchains it fails to filter the appropiate flags and ends up failing. 

Reproducible: Always

Steps to Reproduce:
1. Compile the kernel with gcc
2. Switch to llvm sometime later
3. Compile nvidia-drivers with clang
Comment 1 acertig04 2022-12-27 01:33:39 UTC
Created attachment 845105 [details]
config.log from nvidia-drivers
Comment 2 Mike Gilbert gentoo-dev 2022-12-27 02:02:28 UTC
I think this is a case of "don't do that".
Comment 3 Ionen Wolkens gentoo-dev 2022-12-27 03:23:54 UTC
fwiw nvidia ebuild already has some logic to handle mismatch with clang kernels but not the other way around (given widely used, issues like these come up more often than other modules), but it doesn't work both ways so I could just extend it.

Generally feel should be handled by linux-mod.eclass, but not something I feel like getting into testing for other modules myself.
Comment 4 Larry the Git Cow gentoo-dev 2022-12-27 11:11:43 UTC
The bug has been closed via the following commit(s):

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

commit 65f99fae2270d133ca528c209959925884019c77
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2022-12-27 08:03:09 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2022-12-27 11:11:13 +0000

    x11-drivers/nvidia-drivers: more thorough kernel toolchain handling
    
    Should "hopefully" cover most use cases without regressions.
    
    Makes some degree of sense to do this on (at least) nvidia-drivers,
    given it's widely used and compiles a lot of non-modules things and
    users may not want to use the same toolchain for these.
    
    e.g. can now do
      clang+lld+thinlto kernel + gcc+bfd nvidia
    or
      gcc+bfd kernel + clang+lld+thinlto nvidia
    Not that going to support every custom mixing possible, and please
    consider clang kernel an unsupported configuration despite this
    (hardly tested).
    
    Could be interesting to have linux-mod handle this, but that may
    be better to consider for EAPI=9 so it doesn't unexpectedly break
    anything (meanwhile it's simple to use a package.env for non-nvidia).
    
    Closes: https://bugs.gentoo.org/888587
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 .../nvidia-drivers/nvidia-drivers-390.157.ebuild   | 62 +++++++++++++++++----
 .../nvidia-drivers-470.161.03.ebuild               | 62 +++++++++++++++++----
 .../nvidia-drivers-510.108.03.ebuild               | 62 +++++++++++++++++----
 .../nvidia-drivers/nvidia-drivers-515.86.01.ebuild | 64 ++++++++++++++++++----
 .../nvidia-drivers/nvidia-drivers-525.47.04.ebuild | 64 ++++++++++++++++++----
 .../nvidia-drivers/nvidia-drivers-525.60.13.ebuild | 64 ++++++++++++++++++----
 6 files changed, 306 insertions(+), 72 deletions(-)
Comment 5 Ionen Wolkens gentoo-dev 2022-12-27 11:14:09 UTC
Please ping if still issues, fine with my own setup at least.

Note can set KERNEL_CC/LD/NM and such if need to override yourself, albeit normally unneeded.