Opened 3 years ago
Closed 2 years ago
#20425 closed defect (fixed)
VBox guest fails to run on Linux host with host-kernel built with clang.
Reported by: | DanglingPointer | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 6.1.22 |
Keywords: | dkms clang linux | Cc: | |
Guest type: | other | Host type: | Linux |
Description
For one of my hosts, I'm recently trying out llvm/clang built linux kernel. After installing the kernel in the host and restarting it; the VBox Manager works but VM guests won't start.
Checking the vbox-setup.log shows that dkms is trying to build the vboxdrv modules using "gcc" explicitly and failing. Typical errors are
gcc: error: unrecognized command-line option ‘-Qunused-arguments’ gcc: error: unrecognized command-line option ‘-Qunused-arguments’ gcc: error: unrecognized command-line option ‘-mno-global-merge’ cc: error: unrecognized command-line option ‘-Qunused-arguments’ cc: error: unrecognized command-line option ‘-mno-global-merge’ cc: error: unrecognized command-line option ‘-mno-global-merge’ cc: error: unrecognized command-line option ‘-mno-global-merge’ cc: error: unrecognized command-line option ‘-mno-global-merge’g c: error: unrecognized command-line option ‘-mno-global-merge’g c: error: unrecognized command-line option ‘-fsplit-lto-unit’
I tried again using "update-alternatives" command to set "cc" to point to clang as a work around
$ cc --version; c++ --version Ubuntu clang version 12.0.0-3ubuntu1~20.04.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Ubuntu clang version 12.0.0-3ubuntu1~20.04.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
But it still didn't work and produced the exact same errors in the vbox-setup.log. I suspect because somehow dkms is explicitly trying to build the modules using "gcc" instead of "cc".
Here is part of one line example from the log:
gcc -Wp,-MMD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/11/include ...
I'm not sure what to do next.
For now I have reverted to a Linux kernel host built using gcc which works perfectly. Please advice or fix the dkms setup so that it isn't hardcoded to use gcc. Perhaps figure out whether to use gcc or clang based off the host kernel somehow; or perhaps change the dkms setup to use "cc/c++" instead which is configured by "update-alternatives".
I am running Ubuntu 20.04 and the llvm/clang built kernel is 5.12.10
Attachments (1)
Change History (3)
by , 3 years ago
Attachment: | vbox-setup.log added |
---|
comment:2 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thank you for reporting the issue. It should be fixed in VirtualBox 6.1.36. Please refer to https://www.virtualbox.org/wiki/Downloads page.
vbox-setup.log