Qt4.8.5 开发环境搭建没有生成makefile文件【编译出现的问题】

  1. 安装 Qt 过程中 没有生成makefile文件

yechuang@yechuang:~/Qt$ sudo apt-get install libX11-dev libXext-dev libXtst-dev

正在读取软件包列表... 完成
正在分析软件包的依赖关系树      
正在读取状态信息... 完成      
将会安装下列额外的软件包:
  libpthread-stubs0 libpthread-stubs0-dev libx11-6 libx11-dev libxau-dev
  libxcb1 libxcb1-dev libxdmcp-dev libxext-dev libxext6 libxi-dev libxi6
  libxtst-dev libxtst6 x11proto-core-dev x11proto-input-dev x11proto-kb-dev
  x11proto-record-dev x11proto-xext-dev xtrans-dev
下列【新】软件包将被安装:
  libpthread-stubs0 libpthread-stubs0-dev libx11-dev libxau-dev libxcb1-dev
  libxdmcp-dev libxext-dev libxi-dev libxtst-dev x11proto-core-dev
  x11proto-input-dev x11proto-kb-dev x11proto-record-dev x11proto-xext-dev
  xtrans-dev
下列软件包将被升级:
  libx11-6 libxcb1 libxext6 libxi6 libxtst6
升级了 5 个软件包,新安装了 15 个软件包,要卸载 0 个软件包,有 537 个软件包未被升级。
需要下载 5,152kB 的软件包。
解压缩后会消耗掉 8,958kB 的额外空间。
您希望继续执行吗?[Y/n]
【警告】:下列软件包不能通过验证!
  libxcb1 libx11-6 x11proto-core-dev libxau-dev libxdmcp-dev
  x11proto-input-dev x11proto-kb-dev xtrans-dev libpthread-stubs0
  libpthread-stubs0-dev libxcb1-dev libx11-dev libxext6 x11proto-xext-dev
  libxext-dev libxi6 libxi-dev libxtst6 x11proto-record-dev libxtst-dev
不经验证就安装这些软件包吗?[y/N]
E: 有些软件包不能通过验证

  • 进入刚刚解压的 qt 源码目录中:cd qt-everywhere-opensource-src-4.8.5/; 执行./configure, 出现如下图所
    示,选择开源版本
yechuang@yechuang:~/Qt/qt-everywhere-opensource-src-4.8.5$ ./configure
Which edition of Qt do you want to use ?

Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.

o


This is the  Open Source Edition.

You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU General Public License (GPL) versions 3.

Type '3' to view the GNU General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of either license? yes
……………………
 
g++ -o "/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5/bin/qmake" project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o qfilesystementry.o qfilesystemengine_unix.o qfilesystemengine.o qfilesystemiterator_unix.o qfsfileengine_unix.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlocale_unix.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o  
Basic XLib functionality test failed!
 You might need to modify the include and library search paths by editing
 QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++.
 
编译之后执行$make 没有出现makefile,检查其原因,考虑是上一步sudo apt-get install libX11-dev libXext-dev libXtst-dev安装的问题,不能用回车来选择一些选项,这里不要偷工减料咯,重新安装编译执行:
$ sudo apt-get install libX11-dev libXext-dev libXtst-dev
…………现象
正在设置 x11proto-xext-dev (7.1.1-2) ...
正在设置 libxext-dev (2:1.1.1-2ubuntu0.1) ...
正在设置 libxi6 (2:1.3-3ubuntu0.2) ...

正在设置 libxi-dev (2:1.3-3ubuntu0.2) ...
正在设置 libxtst6 (2:1.1.0-2ubuntu0.1) ...

正在设置 x11proto-record-dev (1.14-2) ...
正在设置 libxtst-dev (2:1.1.0-2ubuntu0.1) ...
正在处理用于 libc-bin 的触发器...
ldconfig deferred processing now taking place
可能这就是编译成功了吧,再次重新编译源码。
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.8.5

To reconfigure, run 'make confclean' and 'configure'.

yechuang@yechuang:~/Qt/qt-everywhere-opensource-src-4.8.5$ ls
bin              configure.exe  INSTALL             Makefile      src
changes-4.8.5    demos          LGPL_EXCEPTION.txt  mkspecs       templates
config.profiles  doc            lib                 plugins       tools
config.status    examples       LICENSE.FDL         projects.pro  translations
config.tests     imports        LICENSE.GPL3        qmake         util
configure        include        LICENSE.LGPL        README

在这里就看出了已经生成了makefile了,执行

yechuang@yechuang:~/Qt/qt-everywhere-opensource-src-4.8.5$ make

2.上找不到qmake的解决办法

tangbin@ubuntu:/usr/local/Trolltech/QtEmbedded-4.8.5-arm/bin$ gedit /etc/profile
添加环境变量。
 

或者

root@yechuang:/usr/local/Trolltech/Qt-4.8.5/bin# sudo ./qmake -v
QMake version 2.01a
Using Qt version 4.8.5 in /usr/local/Trolltech/Qt-4.8.5/lib
原文地址:https://www.cnblogs.com/yechuang/p/4511348.html