Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels (Read 2299 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Ahoj,

according to this comment from VirtualBox upstream:
Quote
We do not officially support CLANG on Linux host (only GCC is supported).
clang compiled Linux kernels are not supported by the VirtualBox host kernel modules.
And I experience kernel freeze when I actually do that.

So I suggest to add some logic to the virtualbox PKGBUILD that the package virtualbox-host-dkms only compiles a module for Linux kernels compiled with gcc, not with clang.

Regards!

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #1
I don't know if I get it right, but we're already using gcc. You can check on the same PKGBUILD you left on the link.

marzosh

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #2
I don't know if I get it right, but we're already using gcc. You can check on the same PKGBUILD you left on the link.
I mean when someone has a custom compiled kernel, and has this compiled using CLANG.

As I have.

And then install virtualbox-host-dkms.

It then, _after_ installing the package, builds virtualbox host modules via DKMS also for CLANG compiled kernels, and it builds them with CLANG.

And when I then launch a VirtualBox VM, the system hard-freezes.

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #3
Briefly looking, this seems like upstream and intended behavior by dkms If it detects that the kernel is compiled with clang, it will use clang for dkms so nothing in that package would change this.

I'm not even sure if what you are attempting would even work anyway. I thought all modules need to be compiled by the same compiler. At the very least, I know things go wrong if gcc versions mismatch so mixing clang and gcc sounds like a recipe for failure. If you need this module, I would suggest just sticking to gcc for your kernel. But regardless, this is beyond our control AFAIK. Artix is a gnu distro so we use gcc for everything by default.

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #4
Briefly looking, this seems like upstream and intended behavior by dkms If it detects that the kernel is compiled with clang, it will use clang for dkms so nothing in that package would change this.
This is correct, and the resulting module makes the system freeze once a virtual machine is launched.

I'm not even sure if what you are attempting would even work anyway. I thought all modules need to be compiled by the same compiler.
Yes.

What I want to achieve is that the module should not build at all in the clang case.

Here is a report to Arch Linux' official extra/virtualbox-host-dkms package with a patch suggestion for that package. 
It should result in that the host modules are only build if the kernel is compiled with gcc, and not built at all otherwise.


Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #6
Hi, dreieck. Ok, I pushed another version to gremlins with that fix.

Can you test it, please? Thx.

marzosh

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #7
Hi, dreieck. Ok, I pushed another version to gremlins with that fix.

Can you test it, please?
Since I do not have gremlins activated in my repository, and I fear conflicts if I do, I did as follows:
Code: [Select]
git clone 'https://gitea.artixlinux.org/packages/virtualbox.git'
cd virtualbox
[ Edit `PKGBUILD` to only package `virtualbox-host-dkms` ]
makepkg -sfi
[ installed make dependencies ]
[ ... building ... ]
[ confirm "Y" to install package ]
It successfully builds the module only for gcc compiled kernels:
Code: [Select]
:: Running post-transaction hooks...
(1/4) Install DKMS modules
==> dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.11.10-xanmod-customconfig-gcc
==> dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.11.10-xanmod-customconfig-clang
Warning: The /var/lib/dkms/vboxhost/7.1.4_OSE/6.11.10-xanmod-customconfig-clang/x86_64/dkms.conf
for module vboxhost includes a BUILD_EXCLUSIVE directive
which does not match this kernel/arch/config.
This indicates that it should not be built.
==> WARNING: `dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.11.10-xanmod-customconfig-clang' exited 77
==> dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.11.10-vanilla-customconfig-clang
Warning: The /var/lib/dkms/vboxhost/7.1.4_OSE/6.11.10-vanilla-customconfig-clang/x86_64/dkms.conf
for module vboxhost includes a BUILD_EXCLUSIVE directive
which does not match this kernel/arch/config.
This indicates that it should not be built.
==> WARNING: `dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.11.10-vanilla-customconfig-clang' exited 77
==> dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.12.1-artix1-1
==> dkms install --no-depmod vboxhost/7.1.4_OSE -k 6.11.10-vanilla-customconfig-gcc
==> depmod 6.12.1-artix1-1
==> depmod 6.11.10-xanmod-customconfig-gcc
==> depmod 6.11.10-vanilla-customconfig-gcc

So this seems to be resolved as soon as the change makes it to the production repository. Feel free to hit "Solve topic" then.

Regards and thanks!

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #8
Thank you for your reply, we are marking the topic as solved.

marzosh

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #9
I reopen this:
Code: [Select]
BUILD_EXCLUSIVE_CONFIG="!CONFIG_CFI_CLANG"
is the more specific option. It is not specifically clang that makes it fail, but the CFI checks. See Here for more information.

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #10
Hello. I built it with that fix and sent to gremlins.

Can you test it, please? (clone if you prefer). Thank you.

marzosh

 

Re: virtualbox-host-dkms: Compile only for GCC kernels: module freezes clang kernels

Reply #11
Hello. I built it with that fix and sent to gremlins.

Can you test it, please? (clone if you prefer). Thank you.
Tested (already the Arch Linux variant).

Works.

Thank you!