Fresh React Native Project Fails on IOS build (M1 MacBook) - ios

I created my first react-native project and I started metro just fine. But When I try to run IOS it fails to build. Any suggestions on what I should check?
latest Xcode installed
karar#Karars-MacBook-Air TheGlobalDoctor % npx react-native run-ios
info Found Xcode workspace "TheGlobalDoctor.xcworkspace"
info Building (using "xcodebuild -workspace TheGlobalDoctor.xcworkspace -configuration Debug -scheme TheGlobalDoctor -destination id=845FA08B-2299-4B05-B9C9-207405392A77")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TheGlobalDoctor.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace TheGlobalDoctor.xcworkspace -configuration Debug -scheme TheGlobalDoctor -destination id=845FA08B-2299-4B05-B9C9-207405392A77
Xcode Failed Build error:
fatal error: module map file '/Users/karar/Library/Developer/Xcode/DerivedData/TheGlobalDoctor-axdadhlgtbbtzcabxyzzteupuwlt/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found 1 error generated.

I had a similar issue. You can start XCode using Rosetta to circumvent the problem for now.
To do so open 'Applications' and find XCode. Open it's context menu and select 'Get Info'. In the info view, make sure the "Open using Rosetta" checkbox is checked.
(Thx to Karthik posting the solution in his blog)

Related

Can't build or archive app using xcodebuild "...-frameworks.sh: line 42: source: unbound variable"

I am unable to build our app using the xcodebuild command, however if I open the project in xcode and click build or archive from the Product menu, it builds absolutely fine. I can't work out what I am doing differently via cli that is causing it to error.
The command I am using:
xcodebuild archive -scheme Dropless -configuration Release -destination 'generic/platform=iOS' SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
The error:
/ios/Pods/Target Support Files/Pods-Dropless/Pods-Dropless-frameworks.sh: line 42: source: unbound variable Command PhaseScriptExecution failed with a nonzero exit code
I have seen various posts online about this error and all seem to point toward the same thing with the defined architectures, however nothing I do seems to make a difference and if it builds in xcode manually I can't see there being an issue with what I've defined.
This is my settings:
xcode version: 13.4.1
osx version: 12.5.1 Monterey

Build of reactNative app fails on IOS using CLI and xcode

I tried to build a simple reactNative app for ios using CLI and xcode.
Both builds fails with a different error.
Prior to both builds, I ran the following
npm install
pod install
Build using CLI
The steps are:
npx react-native run-ios
Having done so I found some errors on the log file which I am attaching
manish.basdeo#AMAC02SNHPHFVH3 Top100 % npx react-native run-ios
info Found Xcode workspace "Top100.xcworkspace"
info Launching iPhone 11 (iOS 13.3)
info Building (using "xcodebuild -workspace Top100.xcworkspace -configuration Debug -scheme Top100 -destination id=37E2E23C-60E2-42D4-8053-525A907ED979")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening Top100.xcworkspace. Run CLI with --verbose flag for more details.
Build settings from command line:
TOOLCHAINS = com.apple.dt.toolchain.XcodeDefault
Prepare build
note: Using legacy build system
<unknown>:0: error: no such file or directory: '/Users/manish.basdeo/Desktop/Top100/Top100/ios/Pods/#/Users/manish.basdeo/Library/Developer/Xcode/DerivedData/Top100-etyxtwwnmplrdtdxgkmuhxstoudh/Build/Intermediates.noindex/Top100.build/Debug-iphonesimulator/Top100.build/Objects-normal/x86_64/Top100.SwiftFileList'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(1 failure)
2) Build using XCODE
How can I fix both errors?

xcodebuild fails with error=nsconsumed-mismatch when using Xcode11 iOS13 SDK

I use the following command to build/archive my project:
xcodebuild -UseNewBuildSystem=NO -workspace WORKSPACE -scheme TARGET clean archive
The compilation fails with the following error:
error: -Werror=nsconsumed-mismatch is currently enabled, but was not in the PCH file
The same build command works when building against Xcode 10.2/10.3 and iOS 12 sdk.

ARCHIVE FAILED : After updating Xcode from 9.1 to 10.1

Archive was getting created with Xcode 9.1 but it is now failing with below error after updating Xcode to 10.1.
**ARCHIVE FAILED**
The following build commands failed:
SymLink /Users/rsKRISH/dir/build/Release-iphoneos/Output.app /Users/rsKRISH/Library/Developer/Xcode/DerivedData/Output-fdnrztthdyjgzvfkiyrgfpahdjxd/Build/Intermediates.noindex/ArchiveIntermediates/Output/InstallationBuildProductsLocation/Applications/Output.app
(1 failure)
The command I am using is :
xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Debug clean build VALID_ARCHS="armv7 arm64" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/Release-iphoneos" -scheme "$PROJECT_NAME" archive -archivePath build/Release-iphoneos/Output.xcarchive
I am able to create the archive from Xcode but it is failing while using command line.
And there is no other information about error (error number etc.) in the build log.
Does anybody has any idea, what might be the issue ?
OS: MacOS 10.13.6
After making some changes to the build command. I found out that the issue was caused due to build parameter:
CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/Release-iphoneos"
So, I've removed this parameter for now. But the root cause of the error is still unknown since I haven't received any permission error (or any other error), which can explain the reason why SymLink cannot be created at the given build directory.

Archive failed from shell Command line - LD error

Archive failed using shell command but gets successfully archived using Xcode. I'm using xcode 7.3 with cocoapods version 1.0.0, everything was working fine with same Xcode version but with CocoaPods 0.0.32 version.This issue is only for command line. It works fine for Xcode.
Command using for archiving(Internally this command is being used for archiving in Jenkins)
/usr/bin/xcodebuild archive -archivePath ./build/CloudMessage -scheme LTDMessaging -workspace CloudMessage.xcworkspace -sdk iphoneos -configuration Release CONFIGURATION_BUILD_DIR=./build 'CODE_SIGN_IDENTITY=iPhone Distribution: Leadership Team Dev, Inc' PROVISIONING_PROFILE=1d733147-864f-412e-8877-bcccc636ca27
Here is the error i got
Ld /Users/confiz/Library/Developer/Xcode/DerivedData/CloudMessage-afevkkqtjcnmoddycvosdhbgoraa/Build/Intermediates/ArchiveIntermediates/LTDMessaging/IntermediateBuildFilesPath/CloudMessage.build/Release-iphoneos/LTDMessaging.build/Objects-normal/armv7/LTD\ Messaging normal armv7
Anyone know how to get rid of this issue?

Resources