Qt-creator examples fail to build for iphonesimula

2019-05-31 15:58发布

I've successfully installed Qt 5.7.0 and Qt-creator 4.1.0 on El Capitan with Xcode 8.

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/Default-568h@2x.png 2dpainting.xcodeproj/Default-568h@2x.png

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'.

Any advice would be appreciated.

Edit: The build kit warns about the following issue: "Device type is not supported by the Qt version". Device type is 'iOS simulator'.

2条回答
老娘就宠你
2楼-- · 2019-05-31 16:22

I had this stupid error and spent two days to nail down. I was about to downgrade Xcode and thought lets try one more time. Finally nailed down.

Symptom: The simplest project wont build from Qt Creator. The error I would get: CopyPNG failed or something along the line and a hint '-f' unknown parameter.

Reason: xcrun takes both -f and -find from the terminal I can see, but it does not like -f from the script copypng. (copypng is a perl script by the way.)

The solution: Open the file /Applications/Xcode.app/Contents/Developer/usr/bin/copypng and find

 my $PNGCRUSH = `xcrun -f pngcrush`;

changed to

 my $PNGCRUSH = `xcrun -find pngcrush`;

PS: I dint have path problem with xcrun, if you have it'd be good to put the whole path as advised above.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-05-31 16:43

I had the same problem after I had updated my Xcode to version 8.0.

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

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.")

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)"

to:

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)"

And finally afer all of it I got error "The following build commands failed: CopyPNGFile Debug-iphonesimulator/Test01.app/Default-568h@2x.png Test01.xcodeproj/Default-568h@2x.png"

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 script from:

my $PNGCRUSH = `xcrun -f pngcrush`;

to:

my $PNGCRUSH = `/usr/bin/xcrun -f pngcrush`;

And then I finally had built the project without errors and opened it in Xcode.

查看更多
登录 后发表回答