Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 907059 - Can't compile app-emulation/virtualbox-modules with clang compiled kernel
Summary: Can't compile app-emulation/virtualbox-modules with clang compiled kernel
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal enhancement (vote)
Assignee: Viorel Munteanu
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-24 07:06 UTC by sean.v22
Modified: 2023-05-29 14:09 UTC (History)
1 user (show)

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


Attachments
emerge --info output (emerge--info.txt,15.24 KB, text/plain)
2023-05-24 07:06 UTC, sean.v22
Details
Linux kernel config (.config,122.44 KB, text/plain)
2023-05-27 07:45 UTC, sean.v22
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sean.v22 2023-05-24 07:06:09 UTC
Created attachment 862361 [details]
emerge --info output

Reproducable: Always
Kernel version: 6.3.3 (gentoo-sources)
global ~amd64
Steps to reproduce: Compile gentoo-sources with clang and emerge virtualbox-modules.

app-emulation/virtualbox-modules-7.0.8:0/7.0 can't compile with a clang compiled gentoo kernel.

* Warning: building virtualbox-modules with a clang-built kernel is experimental.
Comment 1 Ionen Wolkens gentoo-dev 2023-05-26 23:33:52 UTC
See you have -flto, is the kernel also using lto? (build log would help)

The current ebuild does not consider llvm-nm and that breaks with lto -- fwiw, this will be eventually fixed by https://github.com/gentoo/gentoo/pull/31154

Meanwhile you can try to set LLVM=1 in your environment when emerging virtualbox-modules
Comment 2 sean.v22 2023-05-27 07:43:49 UTC
(In reply to Ionen Wolkens from comment #1)
> See you have -flto, is the kernel also using lto? (build log would help)
> 
> The current ebuild does not consider llvm-nm and that breaks with lto --
> fwiw, this will be eventually fixed by
> https://github.com/gentoo/gentoo/pull/31154
> 
> Meanwhile you can try to set LLVM=1 in your environment when emerging
> virtualbox-modules

Yes the kernel is built with clang full lto. I added my kernel .config if that may help. Meanwhile I'll set the environment to LLVM=1.
Comment 3 sean.v22 2023-05-27 07:45:18 UTC
Created attachment 862684 [details]
Linux kernel config
Comment 4 Viorel Munteanu gentoo-dev 2023-05-27 17:09:17 UTC
Can you also attach the build.log?  I use a clang kernel with lto and it compiles fine for me.  I also tried with gentoo-sources-6.3.3.

That warning you posted is harmless.
Comment 5 Ionen Wolkens gentoo-dev 2023-05-27 17:37:27 UTC
Perhaps only happen with thinlto, haven't checked full. Do make sure you don't have LLVM=1 set if trying to reproduce that (but still with a LLVM=1 + LTO_CLANG_THIN kernel), e.g. errors like:

  ./scripts/check-local-export /tmp/portage/app-emulation/virtualbox-modules-7.0.8/work/vboxdrv/SUPDrvSem.o
./scripts/check-local-export: x86_64-pc-linux-gnu-nm failed
make[3]: *** [scripts/Makefile.build:250: /tmp/portage/app-emulation/virtualbox-modules-7.0.8/work/vboxdrv/SUPDrvSem
.o] Error 143
(note that it's not using llvm-nm, it does use in clang though)

May perhaps need clang-16 or something given this /used/ to work with binutils' nm afaik, I'm not sure when it stopped.

Doesn't happen with e.g. nvidia-drivers given it switches the full toolchain both ways as needed (without needing to set LLVM=1 that is), but linux-mod-r1 does that too and won't require worrying about this in ebuilds anymore. I'll probably go ahead and push it in ~2 days or so.

Anyhow, yeah, still need the build.log to know what's actually going on in this case, this was just a guess.
Comment 6 Ionen Wolkens gentoo-dev 2023-05-27 17:39:26 UTC
Oh and ftr I was testing with kernel 6.1.28
Comment 7 Ionen Wolkens gentoo-dev 2023-05-27 17:41:14 UTC
Oh right, maybe it's just because I don't keep llvmgold around anymore :) It's possible it's using it.