QT 5.2.1无法在Mac OSX 10.8.5上构建

Qt 5.2.1 fails to build on mac OSX 10.8.5

本文关键字:OSX 构建 Mac QT      更新时间:2023-10-16

我在MacBook上下载了QT 5.2.1(.tar.gz),运行Xcode 5.0.2,Unized OS X 10.8.5,并运行此配置:

./configure -prefix $PWD/qtbase -debug-and-release -developer-build -no-c++11 -opensource -plugin-sql-sqlite -qtlibinfix _fmosoft -nomake tests -skip qtwebkit -skip qtwebkit-examples -no-compile-examples

我有几个补丁要添加到qt5.2.1,所以我不能只安装二进制文件。但是我以为我首先尝试使用我的配置选项使用未拉链的代码来构建,而无需任何补丁即可。配置成功,然后我运行

make

运行约5分钟,然后给我这个错误:

../corelib/global/qt_pch.h:58:10: error: 'qglobal.h' file not found with
      <angled> include; use "quotes" instead
#include <qglobal.h>
         ^~~~~~~~~~~
         "qglobal.h"
../corelib/global/qt_pch.h:64:10: fatal error: 'qcoreapplication.h' file not
      found
#include <qcoreapplication.h>
         ^
2 errors generated.
make[4]: *** [.pch/debug/QtNetwork_fmosoft_debug/c++.pch] Error 1
make[3]: *** [debug-all] Error 2
make[2]: *** [sub-network-make_first] Error 2
make[1]: *** [sub-src-make_first] Error 2
make: *** [module-qtbase-make_first] Error 2

我在做什么错?如何在MacBook上构建QT5.2.1?

前缀是安装前缀,它指向构建目录中的qtbase文件夹是没有意义的。构建目录是您必须调用配置的地方。

以下对我有用(从OS X 10.9上的实际构建中倾倒.bash_history):

mkdir $HOME/Qt/build-5.2.1
cd $HOME/Qt/build-5.2.1
~/Qt5.2.1/5.2.1/Src/configure -prefix "$HOME/Qt/5.2.1" -debug-and-release 
  -no-pkg-config -opensource -confirm-license -optimized-qmake 
  -nomake examples
make -j2
make install

make install之后,您将其安装到$HOME/Qt/5.2.1。这就是前缀。