我正在尝试在 Lubuntu 15.04 上安装 VirtualBox,但遇到了一个问题。
当我运行时,VBoxManage --version
我得到输出:
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (3.19.0-16-generic) or it failed to
load. Please recompile the kernel module and install it by
sudo /etc/init.d/vboxdrv setup
You will not be able to start VMs until this problem is fixed.
4.3.26r98988
运行sudo /etc/init.d/vboxdrv setup
后输出如下:
Stopping VirtualBox kernel modules ...done.
Recompiling VirtualBox kernel modules ...failed!
(Look at /var/log/vbox-install.log to find out what went wrong)
这日志内容如下面所述:
make KBUILD_VERBOSE=1 SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 CONFIG_MODULE_SIG= -C /lib/modules/3.19.0-16-generic/build modules
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
arch/x86/Makefile:129: CONFIG_X86_X32 enabled but no binutils support
Makefile:669: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
make[1]: gcc: Command not found
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/tmp/vbox.0
gcc -Wp,-MD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d -nostdinc -isystem -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -Iubuntu/include -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -m64 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -O2 -fstack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -I/lib/modules/3.19.0-16-generic/build/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxdrv/ -I/tmp/vbox.0/vboxdrv/include -I/tmp/vbox.0/vboxdrv/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -Wno-declaration-after-statement -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(SUPDrv_linux)" -D"KBUILD_MODNAME=KBUILD_STR(vboxdrv)" -c -o /tmp/vbox.0/linux/.tmp_SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c
/bin/sh: 1: gcc: not found
scripts/Makefile.build:257: recipe for target '/tmp/vbox.0/linux/SUPDrv-linux.o' failed
make[2]: *** [/tmp/vbox.0/linux/SUPDrv-linux.o] Error 127
Makefile:1394: recipe for target '_module_/tmp/vbox.0' failed
make[1]: *** [_module_/tmp/vbox.0] Error 2
Makefile:289: recipe for target 'vboxdrv' failed
make: *** [vboxdrv] Error 2
答案1
您的错误表明gcc
- GNU C 编译器 - 不存在于您的系统中。要获取它,您应该安装build-essential
一个元包,它将引入编译器和编译所需的大多数标准库作为依赖项。
运行此命令来安装它:sudo apt-get install build-essential