您的位置:首页 > 编程语言 > Qt开发

Mac下编译32位Qt 问题总结

2016-08-03 16:31 851 查看
第一次在mac下编译Qt 32bit 库。无数的蛋疼。最后成功运行。
所以写一下这篇东西。不知道能不能帮到别人,但是自己记录一下。
开始直接下载:http://download.qt.io/archive/qt/5.6/5.6.0/

qt-opensource-mac-x64-clang-5.6.0.dmg,
安装运行,后来公司给的外部库是32位的原因,所以用64位的Qt编译会出现:
:-1: error: symbol(s) not found for architecture x86_64
:-1: error: linker command failed with exit code 1 (use -v to see invocation)

所以需要用32位的Qt去编译,官网没有32位直接下载,所以只能自己编译。
下载:http://download.qt.io/archive/qt/5.6/5.6.1/single/

qt-everywhere-opensource-src-5.6.1.tar.gz;
忘记为什么下载5.6.1了。(好像当初编译5.6.0有问题我就换了一个版本,结果5.6.1编译也有问题,这里解决的就是这些问题。)

因为第一次编什么都不懂,找到文档:http://doc.qt.io/qt-5/osx.html

运行:

./configure -platform macx-clang-32

会出错,
Project ERROR: /Users/VeCrystal/Downloads/qt-everywhere-opensource-src-5.6.1/qtbase/examples/widgets/mac/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro is lacking
an install target.
make[4]: *** [sub-qmaccocoaviewcontainer-make_first] Error 3
make[3]: *** [sub-mac-make_first] Error 2
make[2]: *** [sub-widgets-make_first] Error 2
make[1]: *** [sub-examples-make_first] Error 2
make: *** [module-qtbase-make_first] Error 2
找了好久,https://codereview.qt-project.org/#/c/156610/1/mkspecs/features/qt_example_installs.prf,unified,一个外国友人回复:

In short, see the bugreport. Find the file qt_example_installs.prf in the Qt sources directory. qtbase/mkspecs/features/qt_example_installs.prf. Remove the recently added error checking on line 103-115. I didn't have the time to verify if the patch changes
anything else in the build.。

后来google: examples,直接说忽略编译,然后参数改成:
./configure -platform macx-clang-32 -nomake examples -nomake tests -skip qtwebengine
然后就可以编译完成。

然后这一步新人注意,install的时候需要先进入超级用户:sudo -s
然后:make install

编译的库就会默认生成在:
/usr/local/Qt-5.6.1
我直接拷贝到之前我们运行安装了的5.6.0下:/Users/XXX/Qt5.6.0/5.6/clang_32
运行Qt Creator配置32位的qmake就可以了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt 32位 mac