Xcode 14.0 Command PhaseScriptExecution failed - ios

After updating Xcode to 14.0 (and accompanying Xcode Command Line Tools), and building my application as I normally would, I'm running into the error you see above. This is a pretty well documented error, but I've tried every solution I've been able to find:
Investigating Keychain settings
Running pod deintegrate and pod install
Cleaning the build folder
Logging off and shutting everything down and turning things back on / logging back in
Entering arm64 as an excluded architecture and subsequently removing it from the .xcworkspace
Combinations of all the above
Ensuring all the Pods I have are not out of date.
I'm at a loss. Your input is greatly appreciated. Thank you.

As it turns out, there was a file generated as part of the build process (I don't know exactly what) with some flag set that I didn't think I needed, so I just deleted it and rebuilt the app. No issues there.
Solution: it helps to comb through staged commits to see if there's anything created that simply isn't needed, and to delete those files ad hoc.

Related

Can't archive with Xcode (error - PhaseScriptExecution failed with a non zero exit code), but the build is successful

I am sorry for the black marks in the image.
I have seen multiple posts suggesting an answer to this problem, Lock unlocks keychain (tried it), pod Update (tried it), clear build(tried it), signing, skip install in build settings(tried it) - None of them actually worked.
I built my iOS app in react native with Expo, after which I did expo eject to create the iOS folder for Xcode build and archiving, the build is successful every time and it even runs on the simulator and in my device(iPhone 7) but it always failed to archive by throwing this error - Uncategorised - Command PhaseScriptExecution failed with a non zero exit code..
Any help to point me in which direction should I go or what can be the possible mistake that I am doing will be of great help. Do let me know if, I should provide any more detail about this. Thank you!
Xcode Version - 11.0
Mac Version - 10.15 Catalina
iPhone OS - 13.1.3
Few links I tried from -
"${PODS_ROOT}/SwiftLint/swiftlint" causes "Command PhaseScriptExecution failed with a nonzero exit code" with Xcode 10
https://github.com/apollographql/apollo-ios/issues/395
https://www.reddit.com/r/iOSProgramming/comments/al9box/getting_an_error_command_phasescriptexecution/
Make sure you have installed your pods correctly. For me I removed all the pods from my pod file, updated the pod through the terminal, then re-added the pods to the pod file and installed through the terminal. This worked perfectly for me.
I had the same exact problem. What worked for me was I opened the podifle and deleted all the pods, then saved it. After that run pod update in terminal. Go back to the podfile and past the pods back into the file and save it. Then run pod update in terminal again. After that open xcode and run the cleaner and then try to Archive...it worked for me.
Based on the previous answers, the following worked for me:
Quit XCode.
Delete all relevant files: Podfile, Podfile.lok, Pods folder and .workspace file.
Recreate the Podfile and open the new .workspace file.
Cheers
PS: In my case, I hit this issue after copying an existing project (workspace) to a new machine.
Try go to accounts and press download manual profilesenter image description here

expected identifier or '(' after zipping on a windows machine

Background
I brought a project down from a GIT repository to a windows machine, zipped it up, and put it on a Google drive.
I then pulled it down to my Mac, unzipped it and where it worked before on my other Mac, I am now getting the following error.
/Users/myname/Desktop/cmh.pubweb.theapp/TheApp/TheApp-Bridging-Header.h:1:9: note: in file included from /Users/myname/Desktop/cmh.pubweb.theapp/TheApp/TheApp-Bridging-Header.h:1:
#import <Google/Analytics.h>
^
/Users/myname/Desktop/cmh.pubweb.theapp/Pods/Headers/Public/Google/Google/Analytics.h:1:1: error: expected identifier or '('
../../../../Google/Headers/Analytics.h
^
<unknown>:0: error: failed to import bridging header '/Users/myname/Desktop/cmh.pubweb.theapp/TheApp/TheApp-Bridging-Header.h'
Notables
- I am running this on xcode 9.1 whereas my other Mac had an earlier version.
- It was written in Swift 3.
What I have done
Read just about every example of this error on Stackoverflow and applied suggestions without success.
Hit google and found one example where someone had an issue with windows doing something to one of the files. I didn't quite understand what they were getting at and applying the suggested fix didn't work out.
I have deleted the entire build folder.
I have performed "Clean Build Folder" without success.
I hesitate to post this as it seems to be a very vague error that has been tackled from a dozen different directions but I am at a loss after a day of trying to hunt this down.
Any suggestions are greatly appreciated.
The general practice is to only commit the Podfile to the repository and not the Pod folder. If that is the case, you will need to setup Pods on your new mac. Make sure you have cocoapods installed and setup on your new mac and then run pod install in your project directory
Based partially on the answer posted by #Malik
Deleted the POD directory in the root of the project folder
Deleted the Podfile.lock file. (left Podfile in place)
Downloaded CocoaPods App https://cocoapods.org/app (this was due to running into cert expiration issues even though all expired certs had been removed. Seems the app deals with it.)
Installed CocoaPods to the target app.
Also changed the project explicite location in the PodFile to reflect the current location in my system.
This resolved the current issues.

Xcode 9 - linker command failed with exit code 1

While compiling the application getting as following error
" compiled with older version of Swift language (3.0) than previous files (4.0) file "
Could you please help me?
Use the xcworkspace to build instead of the xcproject?
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.
Delete the derived data and do a clean build.
And if you are building a framework, make sure you've selected Generic IOS Device while building or set the Build for Active Architecture only as true in Build Settings.
I think this happens because you changed your app name or maybe the target
look to solve this problem see your target in Podfile
and then come back to your xcode in the targets
select your target app and in linked Frameworks and Libraries (the last one down) see if there's
any pods with light color and a strange name than your target in the podfile
and remove it using the minus button down .
I'd rather fix the specific problem, but if none of the other answers worked a full reset can solve it. If you are getting this error and you are also getting error readouts that refer to "duplicate symbol files", AND all other efforts have failed, then a full reset could work for you.
What worked for me:
Read the error report to identify the repo that supposedly contains duplicate files.
Drag repo to the trash.
re-clone your repo.
set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.
After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.
I had the two copies of files in the codebase. Deleting one copy helped code to build successfully
I am probably late for you, but for future devs in problems...
If you have been manipulating the podfile or creating new targets or maybe changing the name of any of them, check that in build phases options your just have correct pod framework for the name of the targets.
if you have pod
first clean project and close Xcode then open terminal and go to folder of Project then pod update
open the project and run
in my case work!
I fixed this problem today by running the app in the simulator using the target associated with the bundle file named in the Build Settings-->Bundle Loader setting of the test target. Previously I had deleted my derived data folder while working on a different target that has a different Product Name than the one associated with the test target bundle file. Rerunning the app in the simulator must have recreated the bundle file in the derived data folder that the test target is looking for and then my tests started running fine.

Build operation failed without specifying any errors for React Native Xcode project

I have a React Native project that works fine most of the time(Android and iOS). But sometimes out of nowhere I receive this error when I am trying to build the Xcode project (Xcode or react-native run-ios):
Build operation failed without specifying any errors.
Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie)
processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.
How do I solve this? Push to a branch on git, fresh clone, npm install, and all is working fine for a period. And after that the problem will repeat. Making fresh clones of project each time is a pain and takes long time. Is there another way or something that I don't know?
Maybe a some files that are in .gitignore is causing the problems, and after a fresh clone that solves the problem. This is the .gitignore file for my iOS project:
# Created by .ignore support plugin (hsz.mobi)
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
I had this same issue and it was fixed by deleting the contents of node_modules and doing a npm install in the parent folder.
I was faced with this problem too. And I noticed that my folder name was too long. I changed the project folder's name with the short one and this error gone. Try to change the project folder name.
It was really a time killer issue. I rebased the complete code base to a collegue's mac where it worked fine. After sparing more than a couple of morning hours I could find a solution.
Solution - Simply shorten your Project folder name (in mac).
This is undoubtedly irritating that its suggested to have longer and meaningful variable names but the folder name has to be this concise.
I had a issue with XCode 9.1 and iOS 11...
I solved this issue moving up my folder to another path, I know it doesn't make sense and is dumb but it really work for me. My project was at /Users/Me/Documents/MyProjectDir and I changed to /Users/Me/Desktop/MyProjectDir
What helped me was removing the ios/build folder in my React Native project, followed by rebuilding the project.
I highly recommend to run the build on console, to see if it outputs any other relevant information.
react-native run-ios --scheme "app-debug" # Or any aproppriate target
Read more about building+archiving from CLI here or try with other OSS tooling like fastlane.
For me it found bugs twice, that both were unrelated with the building process itself:
1) One was fixed rolling back to node v8 (LTS) apparently. It was very obscure, but I suspect had to do with having little memory available (running flow + packager + xcode + spotify + chrome on 8GB RAM MBP)
2) The other one was related to having a space on the xcode output. "App Canary.app" could not be installed. I figured it out doing ls ios/build/Build/products.... This error only happened after upgrading xcode, and wasn't happening with the release target, that did not have any whitespaces.
The only take away here is to run build directly on the console to debug further. You might find out things that are completely unrelated, and probably can't be solved by just removing the build folder.
Hope it helps.
Trashing ios/Build resolved this issue for me
In my case simulator is not shutdown correctly.
So I opened simulator manually again then I got an error that simulator is not shutdown correctly.So I relaunched the simulator successfully and built xcode project again. Error is resolved

xcodebuild failure clang:error no such file or directory:

Having a problem when building with xcodebuild. My project/app builds fine with the Xcode - gui. It simply isn't finding/building the libcryptopp library which is part of the build process.
The error is:
clang: error: no such file or directory: '/Users/builder/repo/ioskpay/xcode-cryptopp/cryptopp/build/Release-iphoneos/libcryptopp.a'
This particular file should be derived from another project inside the main app - xcodebuild simply isn't correctly pointing at the right file folder which should be:
~/Library/Developer/Xcode/DerivedData
Any ideas?
To fix this, go to your project settings, go to Targets and select your main project target. Then go to Build phases. Under Target dependencies add the static library project.
This way, when you compile the main project, the static library subproject gets compiled before the main project and your static library will be available.
I had the same problem, but for a resource file .m
I opened target -> build phases -> Compile sources
and I found the file the compiler was tell it can't find duplicated: one with strange icon and the other with a normal icon. I simply removed the one with strange icon and it worked. ( I added the file multiple times and I had a merge conflict before that which made something wrong in the project file)
For your case I think you need to remove the lib from target dependencies list and add it again. This may work for you.
In Xcode Version 9.2 (9C40b) this happened when I drug a bunch of files into the project, some of which were duplicate. Rather than simply not adding the duplicates, it added them again and only the name, not the path.
In Target > Build Phases > Compile Sources each of the duplicates showed with no "...in" after them. Each one caused the clang error.
After removing all of the duplicates that Xcode collected, the project compiled and ran.
It makes you use the Project Navigator instead of managing your source files in the Finder. Then the Project Navigator can't replace duplicates like any decent file management system (ahem Finder). 🤨
My xCode info is:
I faced similar errors during xcode building projects (native swift, flutter, react native, native script) in which I got error messages related to clang compilar. Errors like:
clang-4.0: error: no such file or directory: '/Users/xxxxxxxx/Library/Developer/Xcode/DerivedData/xxxxxxxxxxxxxxx/Index/Data Store'
clang-4.0: error: cannot specify -o when generating multiple output files
others
Despite of errors related with DerivedData for native apps can be fixed by deleting the directory and, eventually, restart xCode and even restart the machine... in this case, you will see that after deleting the directory and start building process again, the error comes back.
Then, is the moment of checking the clang installation by running clang --version. The normal output will be something like:
as you can see the InstalledDir is incorrect for xCode. In my case, some days ago I needed to install Anaconda app (R, Python, etc) and, now, I remember that I had to install some dependencies and one of them was clang and its installation was altered.
To fix this problem (in my case that I will not need anaconda any more): (edited)
1.- Delete anaconda and all its dependencies (I recommend to use App Cleaner).
2.- Re-install xCode
After reinstalling xCode, if you type again clang --version, you'll get this:
More info at: https://github.com/flutter/flutter/issues/32457#issuecomment-496161092
Hopefully, this info helps some else.
Best
Ok so by simply adding the correct -target -configuration and -scheme parameters I got this to run correctly. However due to my running this in Jenkins for autobuild purposes it still doesn't work as I'd like - getting stuck in exactly the same place. It's odd because I have the exact same code being built in another job that isn't having this problem. There is no rhyme or reason for it at this point. I will keep shooting rubber bands at it and update when I have an answer...
Sometimes Xcode performs weird.
You have to find that static library project e.g.. "filename.a" under 'Link Binary With Libraries' in Build Phase and then remove it and add it again.
I had the same problem while I was archiving my target. I removed the library and the build succeeded.
For me it was because I had removed a package or pod. I ran pod install and it fixed it
Look for the missing file in the Xcode project i.e the files may be deleted or miss placed.
add the missing files to the xcode, then everything will work fine.
Run this command :
$ conda deactivate

Resources