I'am using OS X Server to build my iOS projects and distribute them. Since I'am using Cocoapods for dependancy management, I've created pre-build action to run pod install, which succeeds and correctly installs the pods.
However, the actual integration process fails with a linker error which is telling me it can't find the pods library:
ld: library not found for -lPods-redacted
Does anyone have an idea, why this happens?
Related
It is very new to me see this problem which started happening recently. Previously my app used to work fine on the iOS simulator by running this command react-native run-ios. Now I have done a lot of research and made my app run via XCode. But somehow the metro bundler is not linked when the app runs via XCode.
I tried running the app via react-native run-ios and every time I am seeing this error. It is too big to copy paste every error here, but here are some of them:
Undefined symbols for architecture x86_64:
"Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld /Users/careerlabsdev/Library/Developer/Xcode/DerivedData/CareerLabs_Elev8-gxcfanteiuxazegkgwkjkrjxbdmw/Build/Products/Debug-iphonesimulator/CareerLabs.app/CareerLabs normal
(1 failure)
I have done a lot of things to make it to work. The only success I got here is, while running the command react-native run-ios, it opens up the metro bundler server. After that it fails with giving a 1000 lines of error. I picked the error which had some cream part. Some key words to pick from the error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Did not understand the word Ld, which is listed under BUILD FAILED
What I did is as follows:
Deleting node_modules, Pods. Cleaning the build from XCode. Running npm install and then cd ios && pod install and then ran the command react-native run-ios
Deleting Pods, Podfile.lock. Did pod install and then in the root react-native run-ios
Doing these:
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install
cd ..
react-native run-ios
Restarted the system, and ran the command again react-native run-ios
Added arm64 in the Excluded Architecture from XCode. Please note, this enabled me to build and run the app successfully on XCode. But it doesn't get attached to the metro bundler server. Looks like it runs the release mode only.
Updated my package react-native-gesture-handler to the latest one which is 1.10.3, to see if that removes my problem. But no luck.
My Podfile look like this:
platform :ios, '10.0'
use_flipper!({'Flipper' => '0.81.0'})
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
I am out of options now, and waiting for some insight to be given. It is indeed frustrating to see an error on something which never created a problem. I am using Apple M1 Chip Macbook.
Update V1.0
I have tried commenting down the use_flipper!(), from the /ios/Podfile, and then redid the same things, like removing Pods, Podfile.lock. Running this command, pod update && pod install && cd.. && npm run ios. Ran into multiple issues. I don't know what the issue is with XCode and React Native on Apple M1.
Update V2.0
I have found some significant places where the developers are complaining about the same. XCode has forced updated my version to 12.5, without my notice. And now XCode is creating a problem with RN Older projects. Here are the supportive links for the same:
Flipper doesn't build with XCode 12.5 (GitHub)
Do I need Flipper? (Reddit)
I hope this may give some insight to the developers who are confused like me. Please take a look, and looks like Facebook is fixing it, but don't know when. Have to keep an eye on it :/
The one hacky thing which I did to make my app run again like before, is to downgrade the XCode Version to the previous stable one, that is Version 12.4. I knew about the problem later, cos, XCode force updated my version which started behaving weird with my already existing project. So the only viable option I saw is to downgrade the version to the previous one, and everything worked like before.
Please Note: This issue exists majorly with Apple M1 along with XCode v12.5 and BigSur OS. So go ahead keeping these things in your mind.
For this, I had to do these things:
Uninstall the XCode completely from the Mac. To do that efficiently, considering XCode does caches a lot of things on your Mac, use Mac App Cleaner. If by any chance, you have just removed the XCode without using the link, then use this Completely remove Xcode from Mac.
Install the XCode from this resource XCode Releases. Please Note: This is a legit source which takes you directly to the Apple's download pages, and no unreliable thing. So you can just go ahead and download the previous stable version of the XCode, with which your app was working fine.
Please Note: Installing the XCode from App Store will again install the latest version of the XCode which is buggy v12.5. So please don't download and install the same from Apple Store. Use the above mentioned source only for best results.
Install it when the file is downloaded. Make sure you follow this Setting up development environment React Native, to avoid any mishaps.
Run the app again.
It will work for you, as it did work for me, and now I am continuing my work on my project without any hassle. Cheers!
I am guessing all third party Pods will need to update their RN Pod Specs to use XCFrameworks. That's what I just did and it seems to work ok.
This means that you, as an RN package user, you will either need to wait for the package authors to update their podspecs to use XCFrameworks or add a build config that excludes the 'arm64' arch (but then will not work on M1 macs).
Alternatively, you can visit the node_modules/<package>/thrid-party.podspec and update it yourself. But that means you will need to build the XCFrameworks yourself too. So.....
I've been facing the following issue since I installed firebase dependencies from https://www.npmjs.com/package/#react-native-firebase/app as specified for React Native. Since then the Xcode console prints out the following error:
"ld: library not found for -lBVLinearGradient clang: error: linker command failed with exit code 1 (use -v to see invocation)"
That lib from Linear Gradient was causing no issue at all since the install of firebase and proper links following the documentation. Now it seems to be affecting other dependencies as well.
I've already re-created the iOS folder, ran pod install and the error persists. After doing that process, I had to link the project using react-native link to load the fonts I was using and the error came back again.
I am using the following version of Xcode: "Version 10.3 (10G8)", and the firebase dependencies inside pods folder are: "Firebase", "FirebaseCore" and "FirebaseCoreDiagnostics".
Note: inside pods folder there is no "LinearGradient" pod at all.
Recent versions of Firebase require at least Xcode 11 - and very soon, will likely require Xcode 12.
I'm trying to import Firebase into my iOS app. I followed this tutorial for doing this manually with Objective-C (as opposed to using CocoaPods).
http://www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/
When I try to build my project, I get the following errors:
"Apple Mach-O Linker Error"
"Linker command failed with exit code 1 (use -v to see invocation)"
I'm familiar with the Linux CLI (less so with Macs), but I don't understand how to apply the -v flag to XCode's build process to get more info.
I've been Googling this for the last 3 hours, but every answer I find seems to be directed at users who weren't using an XCode workspace with CocoaPods.
I don't have CocoaPods installed, so I don't think this is my issue. Despite that I have converted my project and properly imported it into an XCode workspace, this still didn't solve my problem.
My app is a Swift project, and I have imported the modulemap, firebase.h, and googleServices.plist files.
I've also made my Header and Library search paths recursive for the entire project folder in an attempt to fix this.
Here's my project navigation. Although at this point I suspect it's some kind of build setting that isn't correct.
Some selected answers I've tried to apply without success:
Apple Mach -O Linker command failed
In Xcode how do I create a new workspace and add 1 project to it so that I can see the project and its files?
Framework not found GoogleToolboxForMac
Adding system header search path to Xcode
https://github.com/firebase/firebase-ios-sdk/issues/258
Apple Mach-O Linker & Ditto Error - Xcode 8
https://github.com/invertase/react-native-firebase/issues/198
https://forum.ionicframework.com/t/ios-xcode-8-apple-mach-o-linker-ld-error-group-in-xcode/89903
Upgrading to xcode 9.2 fixes this. It appears to be an issue with earlier versions not properly handling linking.
Which is misleading b/c the firebase documentation indicates it's compatible with xcode 8. But I think that's assuming you use cocoapods. If you don't, and instead try to link the obj-c frameworks you need xcode 9+
Once I knew how to examine the more verbose linking error, googling for x86_64 led me to some helpful answers.
This and other answers helped me investigate upgrading.
ld: framework not found Stripe for architecture x86_64
I'm using Parse-Server/Heroku and just installed the pod for Parse in an iOS project of mine (written in objective C).
I am using Xcode Version 9.2 and pod version 1.3.1.
The macOS is High Sierra Version 10.13.2.
When I try to build the project, I get this error:
ld: library not found for -lBolts
clang: error: linker command failed with exit code 1 (use -v to see invocation)
But Bolts seems to be installed, as a dependency when I run pod install.
Any idea about what I can do to solve the problem?
I presume the information I am giving here may not be enough. If more is needed to solve the issue please let me know what I should provide.
If you're using cocoapods, make sure you're opening the generated workspace and not the project itself.
I am actually trying to integrate PLCrashReport using either a Framework (the one given on the official website) or Carthage.
Carthage won't compile the framework, and the manual drag & drop with the one downloaded from the website would produce the following error when installing the app on the device (Run build)
App installation failed
Could not inspect the application package.
I use a build target of iOS8, I linked the framework as an embedded binary to ship it with the app ; and this error is very annoying.
Xcode is in 7.3
Right now, I tried manual build for the framework, clean of the project. None would work.
By curiosity, I tried Cocoapod integration for this library, it worked, but Cocoapod is NOT an option on my project so I can't go with it.
Does anyone have had the same issue, any ideas for correcting it ?
Finally found a way to make it work :
PLCrashReporter should NOT be in embedded frameworks, just in linked frameworks. Works like a charm now, debug and release builds !