How to solve Xcode compile warning: "when processing... in... no such file or directory"? - ios

When I build in Debug schema, I see no warnings, but in Release I get 2 warnings:
while processing /Users/[path to my xcode project]/libUserVoice.a(UserVoice.o):
warning: /var/folders/s_/m1fjy19n3_x5tnr4pfvx_z1c1111gp/C/com.apple.DeveloperTools/7.0-7A218/Xcode/SharedPrecompiledHeaders/UserVoice_Prefix-cemskxhozggatlabrcxqvydduxjw/UserVoice_Prefix.pch.pch: No such file or directory
while processing /Users/[path to my xcode project]/libUserVoice.a(UserVoice.o):
warning: /var/folders/s_/m1fjy19n3_x5tnr4pfvx_z1c1111gp/C/com.apple.DeveloperTools/7.0-7A218/Xcode/SharedPrecompiledHeaders/UserVoice_Prefix-axbllcwdvmtdfsgaozoqlvgidayx/UserVoice_Prefix.pch.pch: No such file or directory
In fact there is no such directory as /var/folder/s_.
I think I this is the first release build since update to Xcode 7.3.
What did not help so far:
Cleaning build folder
Restarting Xcode
Removing files in ~/Library/Developer/Xcode/DerivedData/
Removing files in ~/Library/Caches/com.apple.dt.Xcode/
Removing folders and files in all folders /var/folders/.../SharedPrecompiledHeaders
What I observed:
The Xcode parameter Precompiled Headers Cache Path points to a different directory /var/folders/ck/...
What is the reason for these warnings?

OK what finally helped was:
Removing the library libUserVoice.a mentioned in the warning
Getting the source code from github and rebuilding the library
Adding the newly built library
When I removed the new library and replaced it with the old one the warnings appeared again. The old one is a compiled binary that is provided by the vendor. So it seems this has nothing to do with Xcode but with the vendor's build. Still, if anyone can shed light on this issue it would be interesting to know the background.
Hint: Make sure to build the library as a universal binary so it can run on both ARM (iOS device) and i386 (iOS Simulator) architectures.

Related

iOS build time error Asset.xcasset No such file or directory

I'm getting an error while trying to run the app on the simulator, using Xcode 12.4
/Users/apple/Library/Developer/Xcode/DerivedData/CCBC-
exyindmimlkaxncxdeubzcgqxqgc/Build/Intermediates.noindex/CCBC.build/Debug-iphonesimulator/CCBC.build/Script-7DBCCAD36C20635EF76D902C.sh: line 4: /Users/apple/Desktop/MyProjects/CCBC_iOS/CCBC.xcodeproj/xcuserdata/.xcassets/Asset.xcasset: No such file or directory
When I select the Asset.xcasset from files in Xcode it shows the file path as /CCBC_iOS/CCBC/Asset.xcasset
Thanks for your help
For me, I had to delete an old script that references this Asset file to be built within Derived Data. Regardless of how much I deleted Derived Data and cleared Build Folder, this script still runs the XCAssets reproducing this bug. I would recommend checking out your Build Phases and Scripts and removing unnecessary files especially for old projects.

Xcode 12 Upload ERROR ITMS-90085: "No architectures in the binary. Lipo failed to detect any architectures in the bundle executable."

I am working on an app I've published numerous times before. I recently updated to Xcode 12 and am using the Carthage workaround script, which enables me to build Debug builds without problem. When I try to upload an archive to App Store Connect, though, I see this error:
App Store Connect Operation Error
ERROR ITMS-90085: "No architectures in the binary. Lipo failed to detect any architectures in the bundle executable."
I looked around in the xcarchive and can see that in the .app directory, my non-carthage embedded library's directory does not have a unix executable, whereas past successful xcarchive uploads do have that executable.
Any thoughts on how to fix this? Going back to Xcode 11.7 would require changing the app code, so I'm hoping to not have to do that.
Update: Did also try removing and re-embedded the framework in question, but that didn't help.
I finally added a build phase run script that fixes this issue, but will continue to look for a better solution. Anyway here's the script I added --
MISSING_FRAMEWORK_EXECUTABLE="${PROJECT_TEMP_ROOT}/UninstalledProducts/iphoneos/MyFramework.framework/MyFramework"
TO_DIRECTORY="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/MyFramework.framework/"
mkdir -p "${TO_DIRECTORY}"
cp "${MISSING_FRAMEWORK_EXECUTABLE}" "${TO_DIRECTORY}"
Remove POD folder and do Pod install again.
It worked for me , i hope it will work for you as well.

Compile Sources in Xcode has a wrong path associated

I recently renamed my Xcode application and did all the changes required in Xcode settings. I manually renamed the folders. But now when I run the application, build fails. Error I get is no files found by clang. In the Build Phases, under Compile sources, the file path shown is "New_project_Name/Old_project_Name/New_project_Name/file.m" whereas it should be "New_project_Name/New_project_Name/file.m"
I have searched for many different solutions/workarounds & none have helped till now.

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

Unable to build iOS project using command line but fine via Xcode interface

I have an Xcode project. When in Xcode interactively, I am able to run/build/archive using the Ad_Hoc_Distribution configuration but when I run:
/usr/bin/xcodebuild -configuration Ad_Hoc_Distribution clean build
inside my project, I get an error:
/Users/esg/Documents/app-ios/testapp/testapp/AppDelegate.h:14:9: fatal error: 'RestKit/RestKit.h' file not found
#import <RestKit/RestKit.h>
^
1 error generated.
What would cause this to fail from the command line when it works via the interface?
My team has encountered this same issue. After upgrading from Xcode 4.3.2 to 4.4.1, files that used to be found correctly no longer do.
By comparing the output of xcodebuild vs. Xcode's own build logs, and then comparing vs. our Xcode 4.3.2 build logs, we discovered that xcodebuild and Xcode IDE do not build with the same header dependencies anymore. When xcodebuild runs a 4.4.1 build, it uses an incorrect base directory for include files, which does not include the entire current path leading to the .xcodeproj directory. The last two directory nodes in the folder path appear to be truncated.
But building from Xcode IDE worked fine.
We worked around this problem by adding the correct header paths, as Xcode reports it, as an additional header dependency:
$(SRCROOT) is what seems to be interpreted incorrectly when xcodebuild is employed. It should contain the two subdirectories I inserted in the second line.
I can only conclude that there is a ripe and spicy new bug in the xcode/xcodebuild interaction, but you can fix your header dependencies to at least get things compiling.
See my own issue regarding this.
xcodebuild header files not found in ReskIt
I resolved it by changing nothing, but by adding a workspace and a scheme and used it to build. All the header settings were the same as it is being set for Xcode GUI to build.

Resources