Xcode build of flutter app times out during build - ios

I am trying to emulate our flutter app on Mac and I Get this error:
ProcessException: Process timed out:
Command:
/usr/bin/env xcrun xcodebuild -configuration Debug -quiet -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=/Users/samcromer/Desktop/LightBridge-2/build/ios -sdk iphonesimulator -arch x86_64 FLUTTER_SUPPRESS_ANALYTICS=true COMPILER_INDEX_STORE_ENABLE=NO -showBuildSettings
Is there a way to fix this? I am a windows dev so this doesn't make a lot of sense to me.

Related

Flutter run gets stuck on "Running Xcode build"

App runs on macOS but when I try fluter run -v on iOS(iPad), it gets stuck on the following:
Running Xcode build...
[ +2 ms] executing: [/Users/apfox500/Documents/GitHub/AAC-App/ios/] xcrun xcodebuild -configuration Debug VERBOSE_SCRIPT_LOGGING=YES -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=/Users/apfox500/Documents/GitHub/AAC-App/build/ios -sdk
iphoneos -destination id=00008101-001868481EE9001E ONLY_ACTIVE_ARCH=YES ARCHS=arm64 SCRIPT_OUTPUT_STREAM_FILE=/var/folders/hg/mls6tcw111sgfh2t7v539zrh0000gn/T/flutter_tools.j2rCNj/flutter_ios_build_temp_dirBj4KR5/pipe_to_stdout -resultBundlePath
/var/folders/hg/mls6tcw111sgfh2t7v539zrh0000gn/T/flutter_tools.j2rCNj/flutter_ios_build_temp_dirBj4KR5/temporary_xcresult_bundle -resultBundleVersion 3 FLUTTER_SUPPRESS_ANALYTICS=true COMPILER_INDEX_STORE_ENABLE=NO
I've run flutter doctor and nothing is wrong, tried flutter clean and pod deintegrate/pod install many times as well as building directly from Xcode, with nothing working.

xcodebuild archive failure: picking the wrong SDK?

I'm using fastlane to release an app. The simplified version of xcodebuild command to build the app is this:
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos13.6
-destination 'generic/platform=iOS' clean archive
This fails giving (adding a sample):
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/symbolize.cc:55:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/utilities.h:73:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/base/mutex.h:141:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:55:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
I see that it's picking the MacOSX.sdk, I would expect it to pick iPhoneOS sdk present in Xcode directory. Is this the reason for failure? Or something else?
xcrun output:
» xcrun --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
» xcrun --sdk iphoneos --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
Xcode is using the SDK in /Library/CommandLineTools. Instead, it should be using those inside Xcode app. Run
xcode-select -r
or
xcode-select -s "/Applications/Xcode.app/Contents/Developer"
Verify by
xcode-select -p
Some of them may need sudo.
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos
-destination 'generic/platform=iOS' clean archive
In the xcodebuild man page
-sdk [<sdkfullpath> | <sdkname>]
Build an Xcode project or workspace against the specified SDK,
using build tools appropriate for that SDK. The argument may be an
absolute path to an SDK, or the canonical name of an SDK.
Use xcrun --sdk iphoneos --show-sdk-path to check the SDK path.
Check the SDK you have in your Mac. In my Mac, there are iPhoneOS.sdk and iPhoneOS13.7.sdk
iPhoneOS13.7.sdk is a symbolic link and its origin is iPhoneOS.sdk .
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk
Besides,
you can also use xcodebuild -showsdks to see all the sdks
Different parameter for different devices
iOS: -sdk iphoneos
Simulator: -sdk iphonesimulator
watchOS: -sdk watchos
macOS: -sdk macosx

iOS - Objective C dynamic framework emit bitcode for arch x86_64 (simulator)

Have setup a sample on Github, I'm using Xcode v 9.4.1
https://github.com/iousin/TreeFramework
Basically I'm trying to build my framework to include bitcode in the x86_64 simulator build. I tried various settings and tried building on command line, xcodebuild refuses to include bitcode in my simulator build, however it is very happy to include it in the arm64 (device) build.
All the following commands should be able to run from the same folder the above framework is checked out.
Following are the commands I've tried to build the above framework:
xcodebuild ENABLE_BITCODE[sdk=iphone*]=YES BITCODE_GENERATION_MODE=bitcode DYLIB_COMPATIBILITY_VERSION=1 -sdk iphonesimulator -configuration Release -target TreeFramework clean build
xcodebuild OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE[sdk=iphone*]=YES BITCODE_GENERATION_MODE=bitcode -sdk iphonesimulator -configuration Release -target TreeFramework clean build
xcodebuild OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE="YES" BITCODE_GENERATION_MODE="bitcode" -sdk iphonesimulator -configuration Release -target TreeFramework clean build
Ran the following to verify bitcode is emitted (it doesn't in this case).
otool -arch x86_64 -l build/Release-iphonesimulator/TreeFramework.framework/TreeFramework | grep LLVM
However when I build for a device, bitcode is included.
xcodebuild -sdk iphoneos -configuration Release -target TreeFramework clean build
Verify bitcode is emitted:
otool -arch arm64 -l build/Release-iphoneos/TreeFramework.framework/TreeFramework | grep LLVM
Appreciate any help.

Unable to build ios app for simulator using xcodebuild

I am currently want to create a debug simulator build using xcodebuild command rather than xcode IDE.
however, I always see a "debug-iphoneos" folder is generated, which is for the real device. I expected the simulator output folder "Debug-iphonesimulator"
Can anyone take a look at my script and suggest why the script is not working for simulator?
xcodebuild -scheme "TestApp" -configuration "Debug" -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -workspace TestApp.xcworkspace clean archive -archivePath build/TestApp PROVISIONING_PROFILE="$provisioningUUID" CODE_SIGN_IDENTITY="$codeSignIdentity"
now I can run successfully as below:
xcodebuild -arch i386 -sdk iphonesimulator9.3 -workspace "$app.xcworkspace" -scheme "$scheme" -configuration "Debug"
You should run the following instead:
xcodebuild -arch i386 -sdk iphonesimulator9.1 -workspace [name].xcworkspace -scheme [targetName or ProjectName] ONLY_ACTIVE_ARCH=NO VALID_ARCHS="i386 x86_64"
where iphonesimulator9.1 depends on which iPhone Simulator you installed.

xcodebuild PLATFORM_NAME always == iphoneos

I am trying to build Xcode project from command line, using iphonesimulator as SDK. Here is the command line:
xcodebuild -scheme SchemeName -configuration Debug -sdk iphonesimulator PLATFORM_NAME=iphonesimulator clean build
However, when I add a post-build action in Xcode like:
echo "PLATFORM_NAME: ${PLATFORM_NAME}"
it always outputs "PLATFORM_NAME: iphoneos" and not iphonesimulator.
Is this a bug, or there is something wrong in my build configuration? Thanks

Resources