问题描述
我已经使用Xcode 8在El Capitan上成功安装了Qt 5.7.0和Qt-creator 4.1.0.
I've successfully installed Qt 5.7.0 and Qt-creator 4.1.0 on El Capitan with Xcode 8.
我修复了来自qt的 xcode sdk版本错误,现在我尝试构建其中一个示例适用于iphonesimulator.他们都不工作.它们全部失败,并显示以下错误消息:
I fixed the xcode sdk-version errors from qt, and now I'm trying to build one of the examples for iphonesimulator. None of them work. All of them fail with error message of type:
The following build commands failed:
CopyPNGFile Debug-iphonesimulator/2dpainting.app/[email protected] 2dpainting.xcodeproj/[email protected]
我可以确认Debug-iphonesimulator/2dpainting.app目录没有png文件,它实际上位于qt安装目录中的某个位置.将png复制到源文件夹无济于事,因为在运行"make"时该文件夹将被覆盖.
I can confirm that directory Debug-iphonesimulator/2dpainting.app does not have the png-file, it's actually located somewhere within the qt installation directories. Copying the png to the source folder does not help as the folder gets overwritten upon running 'make'.
任何建议将不胜感激.
生成工具包会警告以下问题:"Qt版本不支持设备类型".设备类型为"iOS模拟器".
The build kit warns about the following issue:"Device type is not supported by the Qt version". Device type is 'iOS simulator'.
推荐答案
将Xcode更新到8.0版后,我遇到了同样的问题.
I had the same problem after I had updated my Xcode to version 8.0.
我的第一个错误是"项目错误:Xcode设置不正确.您可能需要通过运行/usr/bin/xcodebuild来确认许可协议."为了解决这个问题,我创建了一个符号链接:
My first error was "Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild."To solve this problem, I created a symbolic link:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
然后我收到错误消息" Project ERROR:当前的iphonesimulator SDK版本(10.0)太旧.请升级Xcode."我在文件 QT_DIR/5.7/ios/mkspecs/macx-ios-clang/features/sdk.prf
Then I got error "Project ERROR: Current iphonesimulator SDK version (10.0) is too old. Please upgrade Xcode."I commented two strings out in file QT_DIR/5.7/ios/mkspecs/macx-ios-clang/features/sdk.prf
lessThan(QMAKE_MAC_SDK_VERSION, "8.0"): \
error("Current $$QMAKE_MAC_SDK SDK version ($$QMAKE_MAC_SDK_VERSION) is too old. Please upgrade Xcode.")
然后我得到了关于模拟器的错误.Qt找不到它.我从以下位置替换了文件 QT_DIR/5.7/ios/mkspecs/macx-ios-clang/xcodebuild.mk 中的代码行:
Then I got error about emulator. Qt could not find it. I replaced line of code in file QT_DIR/5.7/ios/mkspecs/macx-ios-clang/xcodebuild.mk from:
IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /((.*?))/' | tail -n 1)"
收件人:
IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | awk 'match ($$0, /\(([A-F0-9\-]*\))/ ) { print substr ($$0, RSTART+1, RLENGTH-2) }' | tail -n 1)"
最后所有这些我都得到了错误"以下构建命令失败:CopyPNGFile Debug-iphonesimulator/Test01.app/[email protected] Test01.xcodeproj/[email protected] "
And finally afer all of it I got error "The following build commands failed: CopyPNGFile Debug-iphonesimulator/Test01.app/[email protected] Test01.xcodeproj/[email protected]"
发生此错误是因为系统有两个文件 xcrun.脚本/Applications/Xcode.app/Contents/Developer/usr/bin/copypng开始一个,它是一个符号链接.然后我在此脚本中更改了路径来自:
This error occurred due to the fact that the system has two file xcrun. And script /Applications/Xcode.app/Contents/Developer/usr/bin/copypng starts one, which is a symbolic link. Then I changed path in this scriptfrom:
my $PNGCRUSH = `xcrun -f pngcrush`;
收件人:
my $PNGCRUSH = `/usr/bin/xcrun -f pngcrush`;
然后我终于没有错误地构建了项目,并在Xcode中打开了它.
And then I finally had built the project without errors and opened it in Xcode.
这篇关于Qt-creator示例无法为iphonesimulator构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!