Archive failed from shell Command line - LD error - ios

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?

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

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

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)

Xcode 6.3.2 manual build and sign gives error on installation: Application signature not valid

When I´m running my automatic (command line) build, sign and upload script for my app, an error occurs when installing the app: 'Application signature not valid'.
It worked perfect for years before and stopped working 2 weeks ago (maybe due to Xcode update).
The same error occurs when I´m using HockeyApp for Mac OS to build the ipa and upload it.
When I´m doing the same manually in Xcode, then exporting it as .ipa, everything works well.
What could be the problem? I think xcodebuild is doing something different in the signing process than the manual Xcode .ipa-export.
My automatic build process (shortened)
xctool -workspace $WORKSPACE -scheme $SCHEME -configuration $BUILD_CONFIGURATION -sdk iphoneos clean archive
xcrun -log -sdk iphoneos PackageApplication -v "$PRODUCT_PATH" -o $OUTPUTDIR/$APPNAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE"

Why won't my build phase scripts be executed when creating an IPA from command line?

Question - short version:
Why won't my build phase scripts be executed when creating an IPA from the command line?
When I'm running xcodebuild to create an IPA the predefined build phase scripts does not get executed. Why is that?
Question - lengthy version:
I have a workspace with a scheme I want to create an IPA out of from command line.
This works fine except for one thing; I have two scripts in the build phases of the target that is used to put the correct app version (CFBundleShortVersionString) and the correct svn revision number (CFBundleVersion). These to scripts works fine when archiving from xcode but for some reason they do not get run when archiving from command line.
First of all why is that?
Here are the scripts that are working (if archiving form xCode)
When archiving and creating the IPA from the command line I do (the essentials)
# Building
xcodebuild ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -workspace MyWorkspace.xcworkspace/ -scheme MyScheme CONFIGURATION_BUILD_DIR=${PROJECT_BUILD_DIR} -configuration Release clean build
# Creating IPA
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILD_DIR}/${APPLICATION_NAME}.app" -o "${IPA_OUTPUT_PATH}/${APPLICATION_NAME}.ipa"
It works and creates an IPA but none of the build phase scripts gets executed leaving both the revision number and version number untouched.
All suggestions are appreciated!
UPDATE DUE TO BDASH's ANSWER
Instead of making a clean build I make an install as
xcodebuild install ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -workspace MyWorkspace.xcworkspace/ -scheme MyScheme CONFIGURATION_BUILD_DIR=${PROJECT_BUILD_DIR} -configuration Release
The predefined script will IN FACT be executed (can be seen in the project version number) with no errors during the install. However the created IPA will have a size of ~300 bytes (instead of ~10MB) and cannot be installed on a device.
Building the app before installing it, i.e.
# Building
xcodebuild clean build ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -workspace MyWorkspace.xcworkspace/ -scheme MyScheme CONFIGURATION_BUILD_DIR=${PROJECT_BUILD_DIR} -configuration Release
# Installing
xcodebuild install ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -workspace MyWorkspace.xcworkspace/ -scheme MyScheme CONFIGURATION_BUILD_DIR=${PROJECT_BUILD_DIR} -configuration Release
and then creating the IPA will result in an IPA with executed version script and of correct size BUT it is not possible installing it on a device. Trying to put it on a device will give an error message saying
"The program "MyApp" was not installed on you iPhone device "My Device" because an unknown error has occurred."
You have "Run script only when installing" checked for at least one of the script phases. That phase won't be run when using the build action to xcodebuild, only if using the install action.

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