VirtualBox

Ticket #20425 (closed defect: fixed)

Opened 14 months ago

Last modified 4 weeks ago

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

vbox-setup.log Download (21.0 KB) - added by DanglingPointer 14 months ago.
vbox-setup.log

Change History

Changed 14 months ago by DanglingPointer

vbox-setup.log

comment:1 Changed 14 months ago by DanglingPointer

Guest is Ubuntu 20.04 Linux

comment:2 Changed 4 weeks ago by galitsyn

  • Status changed from new to closed
  • Resolution set to fixed

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.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use