Xcode dependency anaylsis error - ios

On my Xcode project, I tried to compile. But I couldn't do that because of some errors
Those are like as follows.
Unable to run command 'CpResource XXX.app' - this target might include its own product.
Unable to run command 'Touch XXX.app' - this target might include its own product.
So I tried to clean project, but I couldn't do that also.
How can I fix these errors?
Hope your help. Thanks.

In Xcode, go to your Products folder and make sure your .app file has no Target Memberships in the file inspector. Nothing should be checked. I had the same issue and that fixed it for me.

Related

xcode 13 executable file not found

I've an error with xcode 13. When i try to run my app on a real device (arm64 architecture) i got the following error:
Executable Not Found
Domain: DVTMachOErrorDomain
Code: 5
Recovery Suggestion: /path/to/file/MyApp.app is not a valid path to an executable file. Please rebuild the project to ensure that all required executables are created. Check your project setting to ensure that a valida executable will be built.
has anyone ever had this problem? The build process finish without errors. Right now i've excluded x86_64 architecture from "Excluded Architectures" option and set the parameter "Architectures" to "Standard Architectures (arm64, armv7)".
TARGET -> Build Settings, search 'VALID'.
Set VALID_ARCHS, add if run with a simulator, else set arm64.
I faced the same problem and resolved it by deleting files and folders below,
Pods ,
Podfile.lock and
mme.xcworkspace
And running pod install
This Error occur because there was a missing file.
Click on the Error icon on the top header and you redirect to errors there you notice there are some files that are not there or missing.
Added the file and run your project again working correctly.
I got the same error and it was just because I didn't change the build settings correctly after I renamed the folder where Info.plist belongs to.
So I needed to change this setting so that it was the same with the actual path of Info.plist:
Did you make sure that the executable file MyApp located in your folder /path/to/file/MyApp.app/ matches the value of the Executable file attribute in your Info project file?
On my machine, the executable path is : /Users/.../DerivedData/Debug-iphonesimulator/Runner.app/Runner. I noticed that the executable name (Runner in my case) was wrong in the Info file. Correcting it fixed the issue for me.
See the the screenshot below :
Check if there are any deleted files(which happens when you pull the code from Git) and add those files back, Close Xcode, Restart the system, Clean the Project and Run the Project this Worked for me.
I had this error as well.
This is not a blanked solution fix.
For me Xcode had some broken references to files, so I had to connect them and set the file location to be "relative to group" vs "relative to project"
The error was being incorrectly reported as "Executable not found" when building the error was more clear.
Build input file cannot be found: '/Users/MY_USER_NAME/Programs/ios/PROJECT_DIR/SRC/file.xib' is not found.
Some file is missing, you just have to add from project folder. Just restart your Mac and open XCode with your project, you will see the missing file.
I have previously tried every possible solution like cleaning derived data, running pod install but nothing worked. Try above solution
Perhaps the executable file entry is wrong in your Info.plist?
The entry Executable file should be set to $(EXECUTABLE_NAME).
Targets -> Build Settings, search plist
Set Generate Info.plist File to No, set Info.plist File with your info.plist file path.
That's works for me.
I encountered this issue just now after setting up a new prefix header to my product target with a wrong file path:
$(SRCROOT)/$(PROJECT_NAME)/PrefixHeader.h
Correct it to
$(SRCROOT)/$(PROJECT_NAME)/PrefixHeader.pch
resolved my issue. What a stupid Xcode!
pod install or pod install --repo-update should work !
For me, I removed the files in Recovered Reference folder. Then this error gone.
Fast forward to 2022, I got this error after having installed a TestFlight version and was trying to run from Xcode. I deleted the app off my phone, ran again, and was able to install successfully. I hope this helps someone!

iOS Swift No Such File or Directory In Debug-iphoneos

Somebody please save me.
This is the error I'm getting. I've tried cleaning, doing a build clean, pod installs and updates. I have not found a solution.
Shell Script Invocation Error Group
/Users/arthuraraujo/Library/Developer/Xcode/DerivedData/Anti-Social_Club-gizjofrkxroutxezxlbuadlvpwbo/Build/Products/Debug-iphoneos/Anti-Social: No such file or directory
I have similar issues in the past and doing the following work for me. Hope your problem is same as mine:
Close xCode
Go to this folder Group
/Users/arthuraraujo/Library/Developer/Xcode/DerivedData/Anti-Social_Club-gizjofrkxroutxezxlbuadlvpwbo/Build/Products/Debug-iphoneos/
and delete Anti-Social.
Restart xCode, clean & build.
It is hard to really tell you the solution with just the information provided. However, the first thing I would try is deleting the derived data, as CodeBender stated. You should also look at your search paths in your project's building settings to make sure your pods are correct/ connecting your pods files to your project.
Possible duplicate of:
Xcode 8 Shell Script Invocation Error
Here is what I did when I got this:
Used this site to completely remove All Versions of cocoapods:
https://superuser.com/questions/686317/how-to-fully-uninstall-the-cocoapods-from-the-mac-machine
Re-installed current stable version of cocoapods (v1.1.1 for me)
Deleted podlock and pods directory
Deleted old .xcworkspace file (this was key for me).
Did "pod install"
Opened xcode and cleaned project and deleted derivedData.
Go to your build phases and remove libReact.a from the linked libraries.
Then add libReact.a but select this one:
libReact.a from 'React' target in 'Pods' project

Xcode Dependencies Error

I was having an issue changing my Target Deployment to 8.4 (its been 9.1since I started the project). I was getting an error saying Parse was setup to use 9.1 so I couldn't change it. Then I changed the platform information in my podfile and reinstalled the pods. Now I am getting these two errors when I try and Build the app.
Check dependencies
Unable to run command 'CpResource RLA\ Volunteer.app' - this target might include its own product.
Unable to run command 'Touch RLA\ Volunteer.app' - this target might include its
own product.
Any help is welcome.
I'm running Xcode 7.1.1 on a Macbook Pro and coding in Swift.
I figured it out. My .app file in my Product folder in Xcode had a selected target. I don't really understand why it worked by unselecting a Target Membership (so nothing is selected when I select the .app file) fixed the dependency errors.

Link error /Build/Products/Debug-iphonesimulator file not found

I have problem with Xcode, keeps giving me a linker error, and it doesn't build the project. The following is the error am getting
ld: file not found:
/Users/someuser/Library/Developer/Xcode/DerivedData/MAR-akbwbarcniqxytctbebckkelkbxs/Build/Products/Debug-iphonesimulator/MAR.app/MAR
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
As some of the fellow developers have mentioned here, the root cause of the error was "Change in Product Name". I fixed it by :
Go to [project]Tests -> general
Select Host Application
Credits : https://stackoverflow.com/a/28906400/2164029
I picked up a project that had this same error. I found that the project name had changed, but the code I had did not reflect that change in the project build settings. To correct, I updated the "Product Name" value (found under targets | Packaging) to the correct value and rebuilt the project. Ran fine.
I got this fixed by selecting the Tests target and searching for Bundle Loader in Build Settings and changing the product name in that path. I got this error because I have changed the Product name. The Bundle loader has the old product name in the path, so it searches for that path.
I had the exact same problem and if you are using cocoapods make sure you open your project with .xcworkspace not .xcodeproj, for me it was that simple.
Make a deep clean of your project by ⌘ Clean (Menu >> Product >> Clean)
I solved by running pod deintegrate https://github.com/CocoaPods/cocoapods-deintegrate:
pod deintegrate
pod install
I found the solution, I have removed what ever was in dependency.
Build Phases -> target dependancies
remove whatever in there.
if there's test target also click on the test in the build phases in the target dependancies remove what ever in there.
I ended up resolving this in Xcode 7.3 by deleting the Bundle Loader values under Build Settings. Seemed risky, but I noticed the other targets didn't have any such values defined; only the test targets (which were failing to build due to this error).
I got the same issue. What I did was to look for a different 'Product Name' listed under Build Settings. I found the old Product Name still listed under Packaging (Both the Product Name and Product Module Name had the old name). I changed it to the new one and the project compiled without error.

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