本問題的解決方法,來源於:http://ubuntuforums.org/showthread.php?t=2136277&page=3 php
安裝vmware tools時,出現如下錯誤。 node
/tmp/modconfig-5e6o62/vmhgfs-only/inode.c:888:4: error: implicit declaration of function ‘vmtruncate’ [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors make[2]: *** [/tmp/modconfig-5e6o62/vmhgfs-only/inode.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [_module_/tmp/modconfig-5e6o62/vmhgfs-only] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-18-generic' make: *** [vmhgfs.ko] Error 2 make: Leaving directory `/tmp/modconfig-5e6o62/vmhgfs-only'
這是vmware tools的一個bug,在linux kernel 3.8.x就會致使這個問題。 linux
建立一個文件夾,將'vmhgfs-fix.sh', 'vmtools.inode.c.patch' 和 'VMwareTools-9.x.x.tar.gz' 放到裏面,執行./vmhgfs-fix.sh 自動打補丁,而後再安裝文件夾中解壓好的vmware tools便可。 shell
vmhgfs-fix.sh文件內容: ubuntu
#!/bin/bash # # Patch to fix VMware-Tools installation in kernel 3.8.x # Working for Ubuntu 13.04 (Xubuntu and Kubuntu also) # # Get VMwareTools file (it should be in the default format VMwareTools-9.x.x...) VMFILE=`ls | grep VMwareTools-9.*` if [[ ! $VMFILE ]] then printf "\nERROR: \nVMwareTools-9.(...).tar.gz not found.\n\nYou should place it in the current folder and/or \nRename it as VMwareTools-9... (default format name)\n\n" exit fi # Check for vmware-tools-distrib folder if [[ ! -d vmware-tools-distrib ]] then printf "\nExtracting VMware-tools...\n" # Extract VMware Tools tar xf $VMFILE else printf "\n/vmware-tools-distrib already exists.\nPlease remove it before applying this patch.\n\n" exit fi # Record the current directory PATCH_DIR=$PWD printf "\nApplying patch to VMware-Tools...\n\n" sleep 3 pushd vmware-tools-distrib/lib/modules/source # Make a backup of vmhgfs.tar cp vmhgfs.tar vmhgfs.tar.backup # Extract vmhgfs.tar tar xf vmhgfs.tar # Go to extracted vmhgfs.tar pushd vmhgfs-only/ # Apply patch patch -p1 < $PATCH_DIR/vmtools.inode.c.patch popd # Remove old vmhgfs.tar rm -rf vmhgfs.tar # Repack new vmhgfs.tar tar cf vmhgfs.tar vmhgfs-only # Remove vmhgfs-only dir which is not needed rm -rf vmhgfs-only popd printf "\nPatch Applied!\n" printf "Now try to install VMware-Tools.\n\n"vmtools.inode.c.patch文件內容:
--- ./inode.c 2013-02-26 02:18:24.000000000 +0000 +++ ./inode.c 2013-05-03 00:34:59.995053850 +0100 @@ -885,7 +885,8 @@ ASSERT(inode); LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: entered\n")); - result = compat_vmtruncate(inode, newSize); + //result = compat_vmtruncate(inode, newSize); + result = 0; // Fix for kernels 3.8.x due to an error in truncate function if (result) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: vmtruncate failed " "with error code %d\n", result));