Ahoj,
according to this comment from VirtualBox upstream (https://www.virtualbox.org/ticket/22064#comment:10):
clang compiled Linux kernels are not supported by the VirtualBox host kernel modules.
And I experience kernel freeze when I actually do that (https://www.virtualbox.org/ticket/22064).
So I suggest to add some logic to the
virtualbox PKGBUILD (https://gitea.artixlinux.org/packages/virtualbox/src/branch/master/PKGBUILD) that the package
virtualbox-host-dkms only compiles a module for Linux kernels compiled with gcc, not with clang.
Regards!
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
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.
Briefly looking, this seems like upstream and intended behavior by dkms (https://github.com/dell/dkms/pull/169) 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.
This is correct, and the resulting module makes the system freeze once a virtual machine is launched.
Yes.
What I want to achieve is that the module should not build at all in the clang case.
Here (https://gitlab.archlinux.org/archlinux/packaging/packages/virtualbox/-/issues/9) is a report to Arch Linux' official
extra/virtualbox-host-dkms package with a patch (https://gitlab.archlinux.org/-/project/38562/uploads/f473627c8b36f3f9653deefb39fab04e/virtualbox_arch_linux_package_build_host_modules_only_for_gcc-kernels.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.
Arch Linux has added it in a much more elegant way:
They added (https://gitlab.archlinux.org/archlinux/packaging/packages/virtualbox/-/commit/cc64173ee428274adc668d68a02c9dbbd2cf1368#7e5f2bce594bb027de31afd330f7e150bc485be6)
BUILD_EXCLUSIVE_CONFIG="CONFIG_CC_IS_GCC"
to the
dkms.conf (https://gitlab.archlinux.org/archlinux/packaging/packages/virtualbox/-/commit/cc64173ee428274adc668d68a02c9dbbd2cf1368#7e5f2bce594bb027de31afd330f7e150bc485be6).
Hi, dreieck. Ok, I pushed another version to gremlins with that fix.
Can you test it, please? Thx.
marzosh
Since I do not have gremlins activated in my repository, and I fear conflicts if I do, I did as follows:
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:
:: 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!
Thank you for your reply, we are marking the topic as solved.
marzosh
I reopen this:
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 (https://gitlab.archlinux.org/archlinux/packaging/packages/virtualbox/-/issues/9#note_227929).
Hello. I built it with that fix and sent to gremlins.
Can you test it, please? (clone if you prefer). Thank you.
marzosh
Tested (already the Arch Linux variant).
Works.
Thank you!