Building project using xcodebuild fails with Xcode 7.2 - ios

I just moved to Xcode 7.2 and am trying to compile a dynamic framework using xcodebuild and lipo
xcodebuild -project ProjectName.xcodeproj -scheme ProjectName -sdk iphonesimulator
This command fails with strange errors like Unsupported architecture (in frameworks like CoreText). The issue has also been discussed here but I don't see a solution which would work. Any help?

This is due to a bug in Xcode 7.2 (and 7.2.1).
A workaround suggestion has been provided in the supplied link since this question was asked. To sum up, you can add the parameter PLATFORM_NAME=iphonesimulator, and then it magically works. For example:
xcodebuild -project ProjectName.xcodeproj -scheme ProjectName -sdk iphonesimulator -arch i386 PLATFORM_NAME=iphonesimulator build
See also my answer here (where there is also another suggestion for a workaround)

Related

How to test a Swift Package, that uses UIKit?

I've created my first Swift Package recently. It's only used in iOS currently, and if it goes anywhere else, it might be on tvOS, but that would be it.
I was having trouble getting UIKit to be used. And I saw this note over here, and that really helped solve my problem:
https://stackoverflow.com/a/58684636/1435520
The command I used (and mentioned above) is this:
swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios13.0-simulator"
However, I'd really like to have unit tests. Running swift test... with the same arguments mentioned for swift build. But then that gives me a new error:
error: module 'XCTest' was created for incompatible target x86_64-apple-macos10.14
So, I guess I'm just wondering if it's possible to do this. Like, how could I create a Swift Package, that uses UIKit, and have it be testable?
I've been using the command xcodebuild as detailed in this forum post, which requires you to also generate a .xcodeproj:
swift package generate-xcodeproj
xcodebuild build -sdk iphoneos -scheme 'MyPackage-Package'
xcodebuild test -destination 'name=iPhone 11' -scheme 'MyPackage-Package'
But if you're using SPM Resources, you'll run into issues as I detailed here: https://bugs.swift.org/browse/SR-13773
I have spent a lot of time trying to run tests of some complex framework. None of the solutions have worked for me.
I found out that generate-xcodeproj is marked as deprecated.
The reason to that I have found here.
"... starting Xcode 11, opening and building packages is directly supported by Xcode ..."
So I run xcodebuild test directly in the package folder, without creating the xcodeproj.
xcodebuild -scheme '<package name>-Package' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPad Air (4th generation),OS=15.0' test
And it have worked.
I was trying to build and test my internal packages on CI, nothing works for me, and generating an xcodeproj will be deprecated in the future.
What works for me is to just specify the target as macOS 10.15 by doing this without anything else:
swift test -Xswiftc -target -Xswiftc x86_64-apple-macosx10.15

How to create ios Xcodeproject using terminal

Hello I wanted to write script for xcode project creation,building and running into emulator for generic development,I tried so many ways but no result,using terminal cordova(phonegap) is creating,building and running xcode project in emulator.How they are handling,please help me to resolve this.
If i create project through xcode how can i add html and image files to xcode using terminal
for building xcode project:
xcodebuild -target ‘AppName.xcodeproj’ -scheme ‘AppName’ -configuration “Debug/Release” -sdk iphoneos6.0/5.0/4.0 -arch “armv7 armv7s” CONFIGURATION_BUILD_DIR=’BuildDirectoryName‘ ONLY_ACTIVE_ARCH=NO/YES

Terminal Command build xcode project for 64 bit with all other also

I am using below command :
xcodebuild -project $PROJECT_NAME.xcodeproj -scheme $PROJECT_NAME -sdk iphonesimulator -configuration Debug
xcodebuild -project $PROJECT_NAME.xcodeproj -scheme $PROJECT_NAME -sdk iphoneos -configuration Debug
for building the application it's working but I need to build our application with iphone/ipad retina 64 bit but it' not working.
for combining
lipo -create "${WS_DIR}/Build/Debug-iphoneos/libRPCCore.a" "${WS_DIR}/Build/Debug-iphonesimulator/libCore.a" -output "${WS_DIR}/Build/RPCLib/libCore.a"
I am not able to build the application for ipad/ipahone retina 64 bit application using terminal command. please help to create the build script.
I suspect this is because you have Build Active Architecture Only set for Debug mode, which is the default setting I believe. This is because there is no need to build for all architectures during debugging as the build is expected to run only on the device being used for debugging.
This is normally turned off for release and you can test this from the command line by using -configuration Release.
BTW I don't believe you need to specify the -sdk option to xcodebuild as the build settings should have that covered.

Have an iOS Simulator libSystem issue to run GH-Unit at command line

Thank you for seeing this question.
I wrote unit tests with GHUnit.
Now I am trying build tests on terminal to connect with Travis CI, and facing a problem.
I basically followed
http://gabriel.github.io/gh-unit/docs/appledoc_include/guide_command_line.html
and customize a command little bit.
Here is customized command
GHUNIT_CLI=1 xcodebuild ONLY_ACTIVE_ARCH=NO -target UnitTest -configuration Debug -sdk iphonesimulator build
After that some compile started, but finally I got error below.
The iOS Simulator libSystem was initialized out of order. This is most often caused by running host executables or inserting host dylibs. In the future, this will cause an abort.
If you know the way to solve, please let me know that.
Thank you.
Had the same issue, running it like this
GHUNIT_CLI=1 xcodebuild ONLY_ACTIVE_ARCH=NO -workspace <yourworkspace> -scheme <scheme> -configuration Debug -sdk iphonesimulator build
solved the problem

xcodebuild doesn't work when specifying -sdk option

I'm trying to manually compile an xcode project and I can't manage to compile it using xcodebuild when I specify an SDK through the -sdk option.
This fails:
/usr/bin/xcodebuild -project "libjpeg.xcodeproj" -configuration "Release" -sdk iphonesimulator -arch i386 CONFIGURATION_BUILD_DIR=build build
and this works:
/usr/bin/xcodebuild -project "libjpeg.xcodeproj" -configuration "Release" -arch i386 CONFIGURATION_BUILD_DIR=build build
I have installed XCode 4.3.3 and Command line tools from the Apple's developer page, and everything else it's working without problems. If I build this project using XCode, it works without problems too. There's no other xcode version in my system.
I should have something really broken in my env, but I can't manage to find it. I'd appreciate any hints you could give me.
You need to specify something like -sdk iphonesimulator6.0
See this answer: parameter for xcodebuild for using latest sdk.

Resources