我想大多数人都遇到过编译内核时执行make xconfig会报如下类似错误
CHECK qt
* Unable to find the QT4 tool qmake. Trying to use QT3
*
* Unable to find any QT installation. Please make sure that
* the QT4 or QT3 development package is correctly installed and
* either qmake can be found or install pkg-config or set
* the QTDIR environment variable to the correct location.
*
scripts/kconfig/qconf.o
这种情况分为两种:老版本的内核源码编译,新版本的内核源码编译(或者新的其他类似,比如buildroot等)。
对于老版本的内核源码情况:
网上搜索结果大多都类似这样的解决方案:http://blog.csdn.net/loongembedded/article/details/17411991,不是说无效,该方法只对低版本的Ubuntu有效,比如12.04以下,14.04的就行不通了,会提示无程序包。新版的Linux内核应该没这个问题,可是大多数还是使用老版本的kernel,那这样该怎么办呢,方法就是自己下载qt的源码进行编译单独安装,并设置QTDIR环境变量的路径即可。
有能力的人可自行下载源码进行编译,源码地址参考:http://blog.csdn.net/wang_shuai_ww/article/details/52572620
为了方便我把编译好的库文件打包上传了,地址是:http://download.csdn.net/detail/u010406724/9632633
注意不要忘记设置~/.bashrc的环境变量,添加一句 export QTDIR=路径 即可,使用source载入新的配置。
对于新版本的内核源码情况:
新版本的相对简单,只需要执行命令:sudo apt-get install libqt4-dev,即可。
我的机器中这两个库都装了,新老版本均可执行make xconfig。
对于新装或者更新过Ubuntu14.04系统的可能会报这个错误:Error: ‘ptrdiff_t’ does not name a type
解决方法是:在include目录下的qglobal.h文件中添加头文件#include <stddef.h>即可
参考解决连接:https://forum.qt.io/topic/16531/error-ptrdiff_t-does-not-name-a-type
说的意思原因是libc库更新的问题。
对于qt不同操作系统有不同的补丁,可参考http://www.linuxfromscratch.org/patches/downloads/qt/
目前我未用到。