React Native and RNFirebase iOS Release Builds Failing - ios

I'm using Firebase via RNFirebase in React Native. I've gone through the steps here: https://rnfirebase.io/docs/v5.x.x/installation/ios.
Debug builds in the Simulator and to my device work just fine, but when I attempt to archive a Release build it fails with this error.
ld: warning: directory not found for option '-L/Users/rob5408/Library/Developer/Xcode/DerivedData/myApp-fggubxxejruuksefqfhjorhysodz/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/FirebaseAuth'
ld: warning: directory not found for option '-L/Users/rob5408/Library/Developer/Xcode/DerivedData/myApp-fggubxxejruuksefqfhjorhysodz/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/FirebaseCore'
ld: warning: directory not found for option '-L/Users/rob5408/Library/Developer/Xcode/DerivedData/myApp-fggubxxejruuksefqfhjorhysodz/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/GTMSessionFetcher'
ld: warning: directory not found for option '-L/Users/rob5408/Library/Developer/Xcode/DerivedData/myApp-fggubxxejruuksefqfhjorhysodz/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/GoogleUtilities'
ld: warning: directory not found for option '-L/Users/rob5408/Library/Developer/Xcode/DerivedData/myApp-fggubxxejruuksefqfhjorhysodz/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/nanopb'
ld: library not found for -lFirebaseAuth
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Also in the build logs I can see that the Debug config builds those targets, but they are not in the output for Release config builds. I get the feeling it has to do with building for all architectures, but don't know how where to start solving that. I just feel like I am poking around without a real strategy to solve it. Any ideas?
Some things I have tried...
Using the Legacy Build System
Removing node_modules and rerunning npm install
Removing / adding the related pods
Deintegerating and readding Cocoapods
Clearing DerivedData
Restarting my computer

I've seen this happen when switching use_frameworks! off and on.
The solution was deleting FirebaseAuth and other libraries from the Build Setting - Other Linker Flags(OTHER_LDFLAGS)

I got help from this PR: https://github.com/invertase/react-native-firebase-starter/pull/61
It was a combo of dropping down to the Legacy Build System in Xcode 10 and upgrading React Native to 0.57.2.

Related

Library not found for -lAFNetworking Xcode issues

ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/AFNetworking'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/JSONModel'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/ReactiveCocoa'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/Realm'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/dom-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/SAMKeychain'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/Sentry'
ld: library not found for -lAFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Some Solutions I tried , and all of below didn't work which was previously suggested on similar stackoverflow questions
Opening xcworkspace, yes I am opening that.Not the project
Restart xcode
Clean & Build multiple times.
Deleted pods folder, and installed pods again.
pod update multiple times
set Build Active architecture Only to Yes
Selected my Target, went to "Build Phases" in "Link Binary With Libraries" removed ".a" file of that library. Clean and Build.
Target -> Build Settings ->Other Linker Flags = $(inherited)
Target -> Build Settings ->Library Search Path = $(inherited)
Note that libPods-om.a is giving me red whenever i add in target ( choose frameworks and libraries to add)
Worth to note, it runs onreal physical device. but not simulator
I had same issue on Xcode 12.4, only on simulators (on device works well).
Solved by adding arm64 for key Any iOS Simulator SDK on Build Settings < Excluded Archicetures. Add on
Project settings, and
Pods settings
Or, you can try another solution (also worked for me):
adding arm64 for key Any iOS Simulator SDK on Project settings
add config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" on Pod file
I had the same issue you are describing. I tried most of the things you mention but none of them worked. In the past I have been 100% successful in running this on the simulator (whenever I was working on a non-UI thing) and needless to say also successful in running it on a real device. Something happened in the last 2 weeks where now neither the simulator nor the real-device can be used.
In the end I just decided to bite the bullet, start from scratch and clone the remote git repository from where the project resides. Note that before doing this I moved my non-working folder into a safe location (Desktop) and cloned the repository into the same location as the non-working used to be.
After that I ran pod install in the folder of the freshly-cloned project and ran it on a physical device. It worked on the first go.
However I still cannot used the simulator. But I'm happy to have gained back the physical device at least.
UPDATE:
SOLUTION FOUND!!
After about a day of researching and trying multiple things. I found a solution here:
https://github.com/CocoaPods/CocoaPods/issues/10059#issuecomment-693346078
Short summary a new entry is added; it is located in Build Settings->User-Defined->VALID-ARCHS. I deleted this, and now I can run both on simulator and on-device.
Please try delete the Derived Data and pod install again /Library/Developer/Xcode/DerivedData
pod install
Go to Build Settings
Add new key under User-Defined section
VALID_ARCHS : armv7 armv7s arm64 arm64e x86_64

Failed to tns build ios due as MDFInternationalization and MaterialComponents directories don't exist

It works on xCode but not with native script tns. tns build android is fine.
When I execute tns prepare ios && tns build ios I get the error below as those directories don't exist. The Debug-iphonesimulator path does exist with a few other files and a folder inside it but MDFInternationalization and MaterialComponents don't.
Merged 749 categories.
Result: 43068 declarations from 140 top level modules
Done! Running time: 3.81413 sec
Saving metadata generation's stderr stream to: /Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt
~/randd/native-script/platforms/ios
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization'
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MaterialComponents'
ld: framework not found MDFInternationalization
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization'
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MaterialComponents'
ld: framework not found MDFInternationalization
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
** BUILD FAILED **
Command xcodebuild failed with exit code 65
I tried to build this using xCode and I got a successful build with a working app in the iPhone simulator.
As per my undersatnding at the time of writing this question, it looks like tns is failing to generate these folders.
What am I missing here?
Someone has answered this on the NativeScript GitHub Repos:
I found the erro. I was openning the project by the wrong file.
This is usually caused by having the .xcodeproj file open instead of
.xcworkspace.
When you run 'pod install' for the first time, it will create an
.xcworkspace file, which includes your original .xcodeproj and a Pods
project. You'll need to close your .xcodeproj and open the
.xcworkspace instead.
This is a common issue when creating a project through Xcode's new
project wizard - I often forget that I'm not in a workspace, which is
required to get Cocoapods to link correctly.
Build failed - ld: framework not found Pods
Copy and Paste this in your Pod file
pod 'MDFInternationalization'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
I was experiencing the very same issu while trying to build the app with XCode 12.
After using xcode-selectto use XCode 11.7 again, to works. Seems like NativeScript 6 is not XCode 12 compatible.
This is why I personally hate hybrid apps, but when your head-office tells you to jump, you say how high...
The app I had to support was built on NS6, with Xcode 11.
It was crashing on launch on "some" iOS 14 devices, so the fix was to rebuild the app with Xcode 12.
But it kept throwing OP's error.
I resolved this error by upgrading the app's Nativescript packages to the latest "Nativescript 6" version available (I didn't want to do a full upgrade to NS7, because that might have introduced some braking changes).
Based on their own article: https://nativescript.org/blog/nativescript-6-7-xcode-compatibility/
.. I udgraded packages to these versions:
"tns-core-modules": "6.5.20",
"tns-ios": "6.5.3",
"nativescript-dev-webpack": "^1.5.1",
Also, previously to generate and run an optimized release build, I was running:
tns run ios --bundle --env.uglify --env.aot
However, with that, app crashes on start.
So now, to get a release build I run:
tns run ios --release

Cocoapods : ld: library not found for -lBolts

I am using cocoapods in one of my projects and after I cleaned the derived data for my project I have started seeing this error
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/Bolts'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/DownPicker'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/MBProgressHUD'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/Parse'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/SCLAlertView-Objective-C'
ld: library not found for -lBolts
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I open up the Debug-iphoneos from Window > Projects I do not see any folders in there now. Since this problem started cropping up after cleaning derived data I do not really know what did I do which stopped generating those folders.
This is how it looks :
This is kind of how it should look, I imagine (From a different project)
I have tried what was suggested here
Cocoapods ld: library not found for -lPods-Projectname
Cocoapods ld: library not found for -lPods-ObjectiveSugar
And a couple more things which I have tried but to no avail, I have faced my fair share of cocoapod niggles. This seems beyond me.
EDIT: I have been doing some more tests with this, I realized that my pods are not even building ! When I clear derived data for any other project, it goes ahead and builds the Pods next time I try to build the project, but not in this project. What setting can wrong ?
This is how the project looks right now :
Any help will be appreciated.
Clean up cocoa pods and install them again.
You can also use tool - https://github.com/CocoaPods/cocoapods-deintegrate
Somehow the option of Find Implicit Dependencies got turned off in the build scheme. SMH.
Hope this can help someone in the future.

Chartboost with Unity 5 on xcode missing linking file

Has anybody used chatboost with unity 5 on IOS? I get a linking error and a warning
warning: directory not found for option '-L/Users/alexm/Downloads/iosFree/LibrariesPlugins/iOS'
ld: library not found for -lChartboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On the Android everything is fine. Do I have to do anything extra other what i mentioned on chartboost integration page?
Make sure that if the Chartboost plugin is using some PostprocessBuildPlayer stuff, that is isn't getting clobbered by a different script.
If, in XCode, you check the build phases tab for linked frameworks and you don't see Chartboost.framework, it's likely the build script not running correctly.

Error Building Xcode Project after installing AFNetworking via CocoaPods

I am facing the following error when I am attempting to build my Xcode Project after installing AFTNetworking 2.4.1 for iOS 7.1 via CocoaPods..
duplicate symbol _main in:
/Users/nnayudu/Library/Developer/Xcode/DerivedData/Fuse-hksjwkrntgavgvflwlisdncfjobw/Build/Intermediates/Fuse.build/Debug-iphoneos/Fuse.build/Objects-normal/arm64/main-2A00476E021EE59C.o
/Users/nnayudu/Library/Developer/Xcode/DerivedData/Fuse-hksjwkrntgavgvflwlisdncfjobw/Build/Intermediates/Fuse.build/Debug-iphoneos/Fuse.build/Objects-normal/arm64/main-31DB0C4487DDF7B.o
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Additionally in the file browser of Xcode, libPods.a and libPods-AFNetworking.a are red.
I have tried removing arm64 from architectures, building and cleaning CocoaPods multiple times and can not seem to get rid of this error. I also tried adding $(PODS_ROOT) to framework search paths without avail.
Is there a possible solution that exists for this problem?
Please help me out.
There was no problem with the installation of AFNetworking and the error was due to a duplicate .xcodeproj file from past code hidden away in the project.

Resources