centos 7.3 安装vmtools,解决无法编译共享文件夹模块
2017-05-04 17:17
519 查看
环境说明:
vmware 12.5.0 build-4352439
centos 7.3.1611 64位,内核版本:Linux version 3.10.0-514.16.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) )
在安装vmtools 时,编译共享文件时会报错,错误信息如下:
大概意思就是由于 vmhgfs-only/page.c 文件中1649 行出现了wait_on_bit函数调用错误,传递的实参太多了
查看include/linux/wait.h 的文件,该文件为操作系统的头文件,在我个人机器上全路径为/usr/src/kernels/3.10.0-514.el7.x86_64/include/linux/wait.h。
wait_on_bit 函数的定义如下
我们再翻看page.c 的源码,page.c 源码在 /opt/vmware-tools-distrib/lib/modules/source/vmhgfs.tar 压缩文件中。
大家可以直接解压
解压命令为
查看page.c 文件
查看page.c 1649 行这个HgfsWbRequestWait函数定义
可以发现在1649 行,程序在调用wait_on_bit 函数时,当 LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) 并且 LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) 时,会为 wait_on_bit 函数传递 4 个参数,不符合wait_on_bit 函数的定义。
所以到这里解决的方式就很简单了,只要将第三个参数人为去掉就可以了,修改后的HgfsWbRequestWait 函数代码
然后大家再对修改后的 vmhgfs-only 源码文件夹重新打包,打包命令如下
然后大家重新安装vmtools 软件就可以了,安装命令
大家一路回车确认即可
vmware 12.5.0 build-4352439
centos 7.3.1611 64位,内核版本:Linux version 3.10.0-514.16.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) )
在安装vmtools 时,编译共享文件时会报错,错误信息如下:
/tmp/modconfig-xkFtz3/vmhgfs-only/page.c: 在函数‘HgfsWbRequestWait’中: /tmp/modconfig-xkFtz3/vmhgfs-only/page.c:1649:23: 警告:传递‘wait_on_bit’的第 3 个参数时将指针赋给整数,未作类型转换 [默认启用] TASK_UNINTERRUPTIBLE); ^ In file included from include/linux/mmzone.h:9:0, from include/linux/gfp.h:5, from include/linux/mm.h:9, from include/linux/pagemap.h:7, from /tmp/modconfig-xkFtz3/vmhgfs-only/page.c:28: include/linux/wait.h:1044:1: 附注:需要类型‘unsigned int’,但实参的类型为‘int (*)(void *)’ wait_on_bit(void *word, int bit, unsigned mode) ^ /tmp/modconfig-xkFtz3/vmhgfs-only/page.c:1649:23: 错误:提供给函数‘wait_on_bit’的实参太多 TASK_UNINTERRUPTIBLE); ^ In file included from include/linux/mmzone.h:9:0, from include/linux/gfp.h:5, from include/linux/mm.h:9, from include/linux/pagemap.h:7, from /tmp/modconfig-xkFtz3/vmhgfs-only/page.c:28: include/linux/wait.h:1044:1: 附注:在此声明 wait_on_bit(void *word, int bit, unsigned mode) ^ make[2]: *** [/tmp/modconfig-xkFtz3/vmhgfs-only/page.o] 错误 1 make[2]: *** 正在等待未完成的任务.... make[1]: *** [_module_/tmp/modconfig-xkFtz3/vmhgfs-only] 错误 2 make[1]: 离开目录“/usr/src/kernels/3.10.0-514.16.1.el7.x86_64” make: *** [vmhgfs.ko] 错误 2
大概意思就是由于 vmhgfs-only/page.c 文件中1649 行出现了wait_on_bit函数调用错误,传递的实参太多了
查看include/linux/wait.h 的文件,该文件为操作系统的头文件,在我个人机器上全路径为/usr/src/kernels/3.10.0-514.el7.x86_64/include/linux/wait.h。
wait_on_bit 函数的定义如下
wait_on_bit(void *word, int bit, unsigned mode) { if (!test_bit(bit, word)) return 0; return out_of_line_wait_on_bit(word, bit, bit_wait, mode); }
我们再翻看page.c 的源码,page.c 源码在 /opt/vmware-tools-distrib/lib/modules/source/vmhgfs.tar 压缩文件中。
大家可以直接解压
解压命令为
tar -xvf vmhgfs.tar
查看page.c 文件
vi /opt/vmware-tools-distrib/lib/modules/source/vmhgfs-only/page.c
查看page.c 1649 行这个HgfsWbRequestWait函数定义
1636 int 1637 HgfsWbRequestWait(HgfsWbPage *req) // IN: request of page data to write 1638 { 1639 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 1640 return wait_on_bit_io(&req->wb_flags, 1641 PG_BUSY, 1642 TASK_UNINTERRUPTIBLE); 1643 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) 1644 return wait_on_bit(&req->wb_flags, 1645 PG_BUSY, 1646 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) 1647 HgfsWbRequestWaitUninterruptible, 1648 #endif 1649 TASK_UNINTERRUPTIBLE); 1650 #else 1651 wait_event(req->wb_queue, 1652 !test_bit(PG_BUSY, &req->wb_flags)); 1653 return 0; 1654 #endif 1655 }
可以发现在1649 行,程序在调用wait_on_bit 函数时,当 LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) 并且 LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) 时,会为 wait_on_bit 函数传递 4 个参数,不符合wait_on_bit 函数的定义。
所以到这里解决的方式就很简单了,只要将第三个参数人为去掉就可以了,修改后的HgfsWbRequestWait 函数代码
1636 int 1637 HgfsWbRequestWait(HgfsWbPage *req) // IN: request of page data to write 1638 { 1639 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 1640 return wait_on_bit_io(&req->wb_flags, 1641 PG_BUSY, 1642 TASK_UNINTERRUPTIBLE); 1643 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) 1644 return wait_on_bit(&req->wb_flags, 1645 PG_BUSY, 1646 TASK_UNINTERRUPTIBLE); 1647 #else 1648 wait_event(req->wb_queue, 1649 !test_bit(PG_BUSY, &req->wb_flags)); 1650 return 0; 1651 #endif 1652 }
然后大家再对修改后的 vmhgfs-only 源码文件夹重新打包,打包命令如下
tar -cvf vmhgfs.tar vmhgfs-only/*
然后大家重新安装vmtools 软件就可以了,安装命令
/opt/vmware-tools-distrib/vmware-install.pl
大家一路回车确认即可
相关文章推荐
- VMware安装Fedora18,升级3.8.2内核,导致hgfs无法编译安装,无法共享文件夹的问题解决方法
- CentOS安装Qt编译错误以及无法调试的问题解决( /usr/bin/ld:cannot find –lGL 和 Debugginghas failed)
- 彻底解决ubuntu8.04上无法完整安装vmware-tools的问题,完整安装后可以与WXP共享文件夹了!
- VM下Ubuntu10.10里安装VMtools成功还是无法显示共享文件夹问题
- Centos6.3 PHP编译安装JSON模块报错解决
- 解决vmware虚拟机中,已安装vmware-tools却无法共享文件夹的问题
- VMware 安装CentOS 6.5图文步骤 以及安装后无法联网的解决办法
- CentOS 安装 Apache 后其他机器无法访问的解决方法
- 虚拟机安装Debian7 后无法使用共享文件夹,提示:无法更新运行时文件夹共享状态: 在客户机操作系统内装载共享文件夹文件系统时出错。
- VMware,win7与linux centos6.4文件互传,linux下挂载windows共享文件夹,vmware tools安装方法
- centos的PHP编译安装模块的基本步骤
- U盘安装Centos后拔除U盘无法启动问题解决方法
- Centos 7安装centreon后无法进行WEB安装解决。
- virtualbox 里安装 Ubutun系统 解决分辩率,拖放,共享剪贴板,共享文件夹等。
- Android 出现编译通过无法安装的解决方式
- (raspberry、bananapi)Archlinux 无法安装yaourt解决办法-----手工编译(不难)(适用于package-query找不到)
- 解决Android Studio编译出来的APK无法安装的问题?
- LINUX下无法载入共享的库文件,特别是源码编译安装
- 解决CentOS安装redis局域网内无法访问的问题
- 安装wampserver后,在www文件夹下面写php文件,而在网页里输入localhost而无法打开php文件时解决办法汇总