Compile Sources in Xcode has a wrong path associated - ios

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.

Related

unity - xcode build failed with NSUserDefaults.mm file not found message, possibly because com.unity.services.core folder is not in project folder

building an XCode project with an .xcodeproj file generated by unity 2021.3.3f1 fails with the message "Build input file cannot be found: 'users/---/ --project name--/Libraries/com.unity.services.core/Runtime/Device/UserIdProviders/NSUserDefinitions.mm' "
When I look in Finder, I notice that the com.unity.services.core does not exist under the Libraries folder.
Some background. I recently moved to trash many Xcode files to free up disk space. I also did a new remove and Install of XCode, in case I deleted anything important accidentally. Non unity files work fine in XCode.
This might be the first project I used 2021.3.3f1 for. I previously used 2019.4.14f1 without encountering this problem.
Is there something I should set in the IOS Player settings of Unity BuildSettings to avoid this problem? (or something that would force the com.unity.services.core folder to be generated in the output project)?
I am very inexperienced in Mac and infrastructure so I apologize in advance if I am missing something very basic.
Thank you
You should clean your build folders and build anew, should work.
In Xcode you can do this by going to Product > Clean Build Folder, in Unity you just manually delete the whole Build output folder (I hope you created a seperate folder specifically for the Build output and didn't just export to the project directory in that case don't delete your project directory just set a new Build output folder ;).

Info.plist not copied to DerivedData causes compilation error in Xcode

I have a problem that cropped up quite recently with a project that has otherwise compiled and built just fine for over a year.
The error I receive is this:
Showing All Issues
Unable to load contents of file list: '/Users/julian/Library/Developer/Xcode/DerivedData/xxxxxxxxx/Build/Products/Debug-iphoneos/OmataRx.app/Info.plist'
There are a couple of peculiar things here.
First, my Info.plist is not named Info.plist. It is named RxInfo.plist and is indicated as such in the Build Settings Info plist File section.
Second, if I go to this directory path, there are no files there whatsoever. Empty directory. So, whatever build phase was attempting to copy the file there, did not do so. But, there is no error or warning of such a step failing.
Third, if I copy my named plist file to that directory, change the name to Info.plist, everything works fine.
Bonkers, eh?
I've tried a variety of things. I've rebuilt after cleaning, I've deintegrated and then re-installed and re-built the Pods. I've gone to Legacy Build System and attempted that. I had a colleague attempt to build from scratch on their system and they had the precise same error. This all happens on Xcode 11.6. On a whim, I tried building with Xcode 12 beta and had the precise same results.
I'm not sure what to attempt next, to be honest. And dragging-and-dropping and renaming the plist file to that Derived Data directory goes against against everything I believe. 🤣
Suggestions are greatly appreciated!

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

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.

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