[vmware]Failed to build vmnet. Failed to execute the build command.

在安裝VMWARE Player 在 Centos 7 時,在啟動時一直出現錯錯誤查看log如下

2014-08-12T10:44:46.032+08:00| vthread-3| I120: Invoking modinfo on "vmnet".
2014-08-12T10:44:46.035+08:00| vthread-3| I120: "/sbin/modinfo" exited with status 256.
2014-08-12T10:44:46.143+08:00| vthread-3| I120: Setting destination path for vmnet to "/lib/modules/3.10.0-123.4.4.el7.x86_64/misc/vmnet.ko".
2014-08-12T10:44:46.143+08:00| vthread-3| I120: Extracting the vmnet source from "/usr/lib/vmware/modules/source/vmnet.tar".
2014-08-12T10:44:46.148+08:00| vthread-3| I120: Successfully extracted the vmnet source.
2014-08-12T10:44:46.148+08:00| vthread-3| I120: Building module with command "/usr/bin/make -j4 -C /tmp/modconfig-onP0x2/vmnet-only auto-build HEADER_DIR=/lib/modules/3.10.0-123.4.4.el7.x86_64/build/include CC=/usr/bin/gcc IS_GCC_3=no"
2014-08-12T10:44:47.288+08:00| vthread-3| W110: Failed to build vmnet.  Failed to execute the build command.

 

在網路中找了許多方案,終於找到如下方案,修改 vmnet.tar 的 fileter.c 

  1. cd /usr/lib/vmware/modules/source
  2. tar -xvf vmnet.tar
  3. cd vmnet-only
  4. vi filter.c
  5. 在第 205 and  235 行將

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)

取代為下

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)

6. cd ..

7. tar -uvf vmnet.tar vmnet-only

8. rm -fr vmnet-only

再次啟動vmware player即可解決