本文转自:https://communities.vmware.com/thread/509898?start=0&tstart=0
主机:win10家庭版
vmware workstation 10.0.7 (其他10.x版本也有这个问题)
客户机:Ubuntu14.04.4-16.x
安装vmware tools时出现下列编译错误,共享文件夹的功能不能实现,剪贴板等正常。
部分错误代码如下:
<span style="font-size:14px;">/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsPackDirOpenRequest’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:417:26: error: ‘struct file’ has no member named ‘f_dentry’
file->f_dentry) < 0) {
^
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsDirLlseek’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:707:32: error: ‘struct file’ has no member named ‘f_dentry’
struct dentry *dentry = file->f_dentry;
^
In file included from /tmp/modconfig-O5xscq/vmhgfs-only/dir.c:39:0:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsReaddirNextEntry’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:993:31: error: ‘struct file’ has no member named ‘f_dentry’
si = HGFS_SB_TO_COMMON(file->f_dentry->d_inode->i_sb);
^
/tmp/modconfig-O5xscq/vmhgfs-only/module.h:89:62: note: in definition of macro ‘HGFS_SB_TO_COMMON’
#define HGFS_SB_TO_COMMON(sb) ((HgfsSuperInfo *)(sb)->s_fs_info)
^
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:1082:26: error: ‘struct file’ has no member named ‘f_dentry’
*entryIno = file->f_dentry->d_inode->i_ino;
^
In file included from /tmp/modconfig-O5xscq/vmhgfs-only/dir.c:30:0:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:1088:44: error: ‘struct file’ has no member named ‘f_dentry’
*entryIno = compat_parent_ino(file->f_dentry);
^
/tmp/modconfig-O5xscq/vmhgfs-only/./shared/compat_fs.h:120:46: note: in definition of macro ‘compat_parent_ino’
#define compat_parent_ino(dentry) parent_ino(dentry)
^
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:1093:52: error: ‘struct file’ has no member named ‘f_dentry’
*entryIno = HgfsGetFileInode(&entryAttrs, file->f_dentry->d_inode->i_sb);
^
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsDoReaddir’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:1173:13: error: ‘struct file’ has no member named ‘f_dentry’
!(file->f_dentry) ||
^
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:1174:13: error: ‘struct file’ has no member named ‘f_dentry’
!(file->f_dentry->d_inode)) {
^
scripts/Makefile.build:257: recipe for target '/tmp/modconfig-O5xscq/vmhgfs-only/dir.o' failed
make[2]: *** [/tmp/modconfig-O5xscq/vmhgfs-only/dir.o] Error 1
make[2]: ** Esperando que outros processos terminem.
Makefile:1394: recipe for target '_module_/tmp/modconfig-O5xscq/vmhgfs-only' failed
make[1]: *** [_module_/tmp/modconfig-O5xscq/vmhgfs-only] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.19.0-15-generic'
Makefile:120: recipe for target 'vmhgfs.ko' failed
make: *** [vmhgfs.ko] Error 2
make: Leaving directory '/tmp/modconfig-O5xscq/vmhgfs-only'
</span>
解决方法:
1. 确保 open-vm-tools没有安装。
sudo apt-get remove open-vm-tools
2.确保完成更新
sudo apt-get update
3.安装了git
sudo apt-get install git
4.运行命令从库中获取工具.
sudo git clone https://github.com/rasa/vmware-tools-patches.git
或者
sudo git clone https://github.com/rasa/vmware-tools-patches
5.进入vmware-tools-folder目录
cd vmware-tools-patches
6.运行补丁下载工具
sudo ./download-tools.sh
下载所有的补丁,或者
sudo ./download-tools.sh latest
下载最新的补丁
7.解压并打补丁
sudo ./untar-and-patch.sh
8.运行 complie.sh file
sudo ./compile.sh