安装中错误信息:
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmmon-only’
make -C /lib/modules/2.6.20-5-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.20-5-generic’
CC [M] /tmp/vmware-config0/vmmon-only/linux/driver.o
In file included from /tmp/vmware-config0/vmmon-only/linux/driver.c:80:
/tmp/vmware-config0/vmmon-only/./include/compat_kernel.h:21: error: expected declaration specifiers or ‘…’ before ‘compat_exit’
/tmp/vmware-config0/vmmon-only/./include/compat_kernel.h:21: error: expected declaration specifiers or ‘…’ before ‘exit_code’
/tmp/vmware-config0/vmmon-only/./include/compat_kernel.h:21: warning: type defaults to ‘int’ in declaration of ‘_syscall1’
make[2]: *** [/tmp/vmware-config0/vmmon-only/linux/driver.o] 错误 1
make[1]: *** [_module_/tmp/vmware-config0/vmmon-only] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-5-generic’
make: *** [vmmon.ko] 错误 2
make: Leaving directory `/tmp/vmware-config0/vmmon-only’
Unable to build the vmmon module.
以上的compat_kernel.h定义与2.6.20的内核有不兼容的地方,那我们就来修改compat_kernel.h使其与compat_kernel.h与内核兼容就可以了。
首先备份原始文件,然后解压vmmon.tar:
cd /usr/lib/vmware/modules/sourcesudo cp vmmon.tar vmmon.tar.oldsudo tar xvf vmmon.tarsudo gedit vmmon-only/include/compat_kernel.h
将21行:
static inline _syscall1(int, compat_exit, int, exit_code);
替换为:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) static inline _syscall1(int, compat_exit, int, exit_code);#endif
然后重新打包vmmon.tar:
tar cvf vmmon.tar vmmon-onlyrm -rf vmmon-only
继续编译,vmmon模块是编译通过了,可是vmnet模块又出现了如下的错误:
make[1]: Entering directory `/usr/src/linux-headers-2.6.20-5-generic’
CC [M] /tmp/vmware-config1/vmnet-only/driver.o
CC [M] /tmp/vmware-config1/vmnet-only/hub.o
CC [M] /tmp/vmware-config1/vmnet-only/userif.o
/tmp/vmware-config1/vmnet-only/userif.c: In function ‘VNetCopyDatagramToUser’:
/tmp/vmware-config1/vmnet-only/userif.c:629: error: ‘CHECKSUM_HW’ undeclared (first use in this function)
/tmp/vmware-config1/vmnet-only/userif.c:629: error: (Each undeclared identifier is reported only once
/tmp/vmware-config1/vmnet-only/userif.c:629: error: for each function it appears in.)
make[2]: *** [/tmp/vmware-config1/vmnet-only/userif.o] 错误 1
make[1]: *** [_module_/tmp/vmware-config1/vmnet-only] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-5-generic’
make: *** [vmnet.ko] 错误 2
make: Leaving directory `/tmp/vmware-config1/vmnet-only’
Unable to build the vmnet module.
现在是vmnet的问题,同样的我们要修改不兼容的代码,然后重新编译。
首先备份原始的vmnet.tar,并解压:
cd /usr/lib/vmware/modules/sourcesudo cp vmnet.tar vmnet.tar.oldsudo tar xvf vmnet.tarsudo gedit vmnet-only/userif.c和bridge.c
将其中的CHECKSUM_HW替换成CHECKSUM_COMPLETE。
然后重新打包:
tar cvf vmnet.tar vmmon-onlyrm -rf vmnet-only
再次编译就一切OK了!
vmware在2.6.20内核下编译出错的解决办法
转载请注明出处:服务器评测 » vmware在2.6.20内核下编译出错的解决办法