问题
Ubuntu 20.04下启动虚拟机VMware
时,报错:Before you can run VMware several modules must be compiled and loaded into the running kernel
. 按提示点击install
无法解决。
解决办法
1 下载vmware-host-modules并切换到对应分支
git clone https://github.com/mkubecek/vmware-host-modules
cd vmware-host-modules
git checkout workstation-16.1.2 #这里16.1.2替换为你的VM版本
这里如果直接执行sudo make & sudo make install
会报以下错误:
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
2. 编辑vm_asm_x86.h
编辑vmware-host-modules/vmmon-only/include/vm_asm_x86.h
将第65行附近的以下内容:
#ifndef USE_UBSAN
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr) \
ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
sizeof(expr) <= 2))
#else
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
#endif
修改为(注释其它,只保留#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
这一行):
// #ifndef USE_UBSAN
// #define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr) \
// ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
// ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
// sizeof(expr) <= 2))
// #else
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
// #endif
3. make & make install
然后再执行:
sudo make
sudo make install
最后,便可成功启动VM.文章来源:https://www.toymoban.com/news/detail-502868.html
参考链接:文章来源地址https://www.toymoban.com/news/detail-502868.html
- 参考链接
到了这里,关于VM报错Before you can run VMware several modules must be compiled and loaded into the running kernel的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!