歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 10.10安裝VMware tools遇到找不到C header的問題解決

Ubuntu 10.10安裝VMware tools遇到找不到C header的問題解決

日期:2017/2/28 16:19:07   编辑:Linux教程

以下問題的解決辦法大多從網絡上搜索得到,自己只是整理照搬過來而已。

在Ubuntu 10.10上安裝vmware tools,我這裡主要遇到的問題都出現在以下這步中,

What is the location of the directory of C header files that match your running kernel? [/usr/src/linux/include]

如果直接回車,會顯示 The path "/usr/src/linux/include" is not an existing directory.

因此,首先要更改該路徑。這裡很簡單,首先用uname -r命令找到當前的linux內核版本,我這裡的版本為2.6.35-25-generic,因此更改後的路徑如下:

“/usr/src/linux-headers-2.6.35-25-generic/include

改後再回車,又出現如下問題:

The directory of kernel headers (version @@VMWARE@@ UTS_RELEASE) does not match your running kernel (version 2.6 . 35 - 22 -generic). Even if the module were to compile successfully, it would not load into the running kernel.

這是不是不匹配,而是因為 Kernel 中有一個變量 UTS_RELEASE 位置改變了。以前這個定義放在 /usr/src/linux-headers-2.6.35-25-generic/include/linux/version.h ,而現在已經移到了/usr/src/linux-headers-2.6.35-25-generic/include/generated/utsrelease.h。所以vmware tools找不到這個變量的定義,修改的辦法有兩種:

1. 在version.h中添加 #define UTS_RELEASE "2.6.35-25-generic"

2. 直接將utsrelease.h拷貝回來,cp -p generated/utsrelease.h linux/utsrelease.h

修改後再回車,仍然存在問題:

The path "/usr/src/linux-headers-2.6.35-22-generic/include" is a kernel header file directory, but it does not contain the file "linux/autoconf.h" as expected. This can happen if the kernel has never been built, or if you have invoked the "make mrproper" command in your kernel directory. In any case, you may want to rebuild your kernel.

根據提示可以知道,是因為找不到 linux/autoconf.h文件,這個文件在新的linux內核中被挪到了 generated文件夾中,因此修改的辦法也很簡單,直接將這個文件拷貝過來即可

cp -p generated/ autoconf .h linux/ autoconf .h

這樣修改完成後,應該就可以順利安裝了。

Copyright © Linux教程網 All Rights Reserved