Following the steps from React Native official tutorial, the xcode project created by "react-native init MyFirstRNProject" won't compile. It complains "React/xxxxx.h" can't be found.
After further investigation of this xcode project, I figured the "React" target contains a build phase "Copy Headers" which copies all exposed headers into a weird location:
"MyFirstRNProject/node_modules/react-native/React/build/Debug-iphonesimulator/include/React"
OK, cool, at least we got the header location. We can change the copied location to somewhere else that better than this. So whichever the project that do "#import < React/xxxxx.h >" should have above path in "Header Search Path" in build settings. Unfortunately, all projects have "Header Search Path" empty. And that's why I'm getting tons of header not found error.
OK, let's add it. Now it finds headers, but compilation still failed, see reference below:
https://github.com/facebook/react-native/issues/21482
The discussion above saying that removing the "Header Search Path" of the projects will solve the problem. But we know that without header search path, it again can't find React headers.
Just curious now, I don't think my setup is wrong, does anyone has the same issue?
I had the same problem on fresh install of Xcode 10.1
There are few steps to follow to compile the new project after react-native init appName
In Xcode, Select File -> Project/Workspace Settings. You will see a Build System option to select the Legacy Build System as shown below
Change Advanced settings, and set Build Location to Custom and change paths to Relative to Workspace and Build/ to build/Build/ as showed.
3. User Debug for command-line builds(for react-native run-ios to work properly)
Clear your project
After this manipulations(don't need set header search paths) you'll be able to build and run empty project via Xcode or CLI
Im building a IOS app that uses a third-party library.
The library project is inherited from another developer that im unable to ask anything.
It is configured to use CocoaPods to manage dependencies, it has a lot of them.
When i run "pod install" it downloads all of them and creates the workspace.
In the workspace i have set the app target as dependent from the framework project product
Then i try to build it and it says it cannot find one of the dependencies of the framework project (it is on the podfile)
Then i found the framework project is missing "[CP] Embed Pods Frameworks" in build phases (the app project has it)
Also the "Pods_[targetName].framework" is shown in red (even when it indeed is in the build products folder, the path is correct)
I found this issue that seems to be exactly my problem but im unable to see if it has been fixed or not and what could i do to workaround this.
Same effect for me, my issue was the s.source_files in the podspec did not reference a location with actual files after a refactor.
I have created a Xcode project with cocoa pods and committed into SVN, When i am taking fresh checkout every time the googleAnalytics or some othe library library is missing. I have chanhed all the settings like Library Search paths, Framework Search paths and other linker flags and given -Objc, $(inherited). But still same issue. Below image showing missing library every new checkout
Image which missing libraries from workspace
Every time when i am taking new checkout pods are missing, I dont want to install pods locally every time. I want commit pods to SVN. Next time when i take fresh checkout it should not give these missing errors.
I have just added Google Analytics to my pods like this:
pod 'Google/Analytics'
just like GA documentation suggests. Now my project won't link. It says:
library not found for -lGGLAnalytics
Did anyone ever encounter this? Thanks
I got the same error. Solved by reseting LIBRARY_SEARCH_PATHS to default value.
Select your target and navigate to Build Settings. Under Search Paths select Library Search Paths and reset it to default by pressing backspace.
In result, the value for Library Search Paths should change from blank:
to default:
Diff in .pbxproj just removes the empty value:
I'm using pods version0.39.0, Xcode 7.2.
In my case the solution was remove all but $(inherited) in Target -> Build Settings -> Other linker flags
Then of course clean and build!
I ran into this and had a very strange cause and different solution from the above, so I figured maybe this might help someone else who shows up here.
I had a working project in my normal directory and I save it to an SVN code repo. I needed to step back to a previous version for something, so I checked out a new copy from SVN and updated it back to the revision I needed.
Then I started getting the library not found for -lGGLAnalytics error.
It turns out that SVN doesn't really like it when you check-in *.a files and it ignores them by default. So my SVN repo had all of the Google Pod code but was missing the libGGLAnalytics.a files and a couple of other .a files.
How I solved it:
I copied the Pods/Google and Pods/GoogleAnalytics directories over from my real project. Then I did a pod install from the command line which updated my project files to reference those files that were previously missing.
I did a Build Clean and all fixed.
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