Apple Mach-O Linker Error When Building Starter Code - ios

I am using Xcode 8.2.1, Swift 3, and IOS 10.2 (for iphone simulator). I am trying to follow this tutorial https://www.raywenderlich.com/139322/firebase-tutorial-getting-started-2
I have not gotten to the Firebase stuff. Right now I am just trying to build and compile the starter code (should run fine). When I do this, however, I get the following error:
ld: library not found for -lPods-Grocr
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How do I fix this? PS. I have done a pod install successfully.

When I first began working with Firebase I encountered many issues like this and for a while wondered if scrapping the whole Application and restarting was the best option. In the end the fix was simply, getting rid of the modules inside my app and uninstalling the pods then going back through the process of installing them. Sometimes a file will be place in the wrong directory so when the app goes to build it is looking for something that cannot be found and it fails. Good luck let me know if you have any more questions or issues.

Related

iOS firebase Mach-O Linker Error without cocapods

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

Xcode 8.3 Archive error: Linker command failed with exit code 1

I started getting this error only after upgrading from Xcode 8.2 to Xcode 8.3, and only when making an archive build (debug builds work fine).
When I do the archive via Xcode, the only message I get is "Linker command failed with exit code 1 (use -v to see invocation).
I build with the command line xcodebuild -scheme MyProduct
When I built this way, I found a number of issues (again, only when doing Archive):
I had to add import UIKit to practically every swift file.
all the pods had issues
remove everything from app-Bridging-Header.h
add a few things back into app-Bridging-Header.h
My current issue is with the AWS pod, using version 2.5.3
So my app-Bridging-Header.h has #import <AWSS3/AWSS3.h>
Here is the error from the command line build:
error: 'AWSS3/AWSS3.h' file not found with <angled> include; use "quotes" instead
#import <AWSS3/AWSS3.h>
^
The error log continues after that. I also tried the crazy suggestion of switch in the import to "AWSS3/AWSS3.h"...that didn't work either.
What is going on?
More INFO
This really appears to be an issue with one of my pods. I built a new solution, imported a subset of my pods and everything built. Then when I updated with the full list of pods it broke.
For me it is coming due to Bitcode enable in my project and i have used a custom framework with disabled bitcode.
Two things you can do :
Either disable bitcode in your project
OR
Build framework with bitcode enable
NOTE: If you click on error and it doesn't show anything then right click on error and select Reveal in Log. You will get error for this issue
At long last I was able to figure out this was a pod issue...just had to figure out which one it was.
I created a brand new project and started adding my pods in one by one (actually, 3 by 3...one by one would have taken too long).
Conclusion: localytics 4.3.1 has a bug in it somewhere. I downgraded to 4.3.0 and the problem went away.
I got a problem like this. My suggestion is that you should remove the version of 8.3 and download any old version from this link: https://developer.apple.com/download/more/
I hope that it will work.

Xcode from Unity: "Linker command failed with exit code 1 (use -v to see invocation)"

I am getting a "Linker command failed with exit code 1 (use -v to see invocation)". As far as I understand, it is telling me that I am missing some framework.
1. I have added all the frameworks manually:
:
After cleaning and trying again, the error still persists but it complains about another framework!
2. I have also set the 'Search Path' in 'Build Settings' to recursive:
Every time I try and built it on my ipad I get the same error but complaining about a different framework despite 1&2. Has come across this?
I am working on Xcode Version 7.3.1
The error screenshot:
Directort Structure:
UPDATED Search Path:
I think that Can You check Project Target>Buil Phases>Link Binary with librarys in more than one time it is define or podfile is define multiple time some frameworks.
I was having the same issue w/ my project. I install my pods via CocoaPods, once I open up the workspace project created, I import the modules to the file. At first there will be an error, but once you Build the project, it will sweep the error. That's how I fixed my issue.
In the end, removing the all the problematic frameworks (those starting with QT) allowed me to build the app and didn't cause any noticeable issues. Its not a particularly satisfying solution, but it worked ...

XCode can't find wrong .app file

I changed the name of my app from X to Y. It was working before, but for some reason it no longer is working after doing a fresh pull. It's giving me this error (from YTests):
ld: file not found: <DerivedData Directory>/X.app/X
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It's looking for X.app instead of Y.app. I've looked through the build settings and it is Y.app everywhere. It's looking for the wrong file inside of Tests. When I disable testing, I can run the app but I still get the error. Any suggestions?
Note: I'm using Xcode6-Beta5.
After digging around, I realized that this was the actual cause of the error. What confused me is that it was working for a while, and then it stopped all of a sudden.
xcode 4 fails to initiate unit tests (with linker error) after I created a new scheme
The solution is:
Go to build settings of the test target.
Search for your old app name.
Replace old app name with new app name. (Linking -> Bundle Loader -> Debug & Release)

Xcode 4.6 causing libobold2d-ios.a not found error in Kobold2D

I'm getting the following error after upgrading Xcode to 4.6 and building my Kobold2D project:
ld: file not found: /Users/Jon/Library/Developer/Xcode/DerivedData/Kobold2D-
awxpgwvfoipnxpdyaptbdirnnfwq/Build/Intermediates/ArchiveIntermediates/Kodable-
iOS/BuildProductsPath/Release-iphoneos/libkobold2d-ios.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It happens only when building the IPA with product>archive. I can run directly on the device no problem. This leads me to believe its a distribution permissions setting.
I've done some research on the error here, and also reviewed similar questions on SO. I have an idea of what the problem is, but none of the solutions seem to fix the issue.
This only just happened with Xcode 4.6. I've been able to build IPAs before no problem, and even have the app in the App Store, so I don't know what changed to cause this.
I figured this out today, so I will answer it for anyone else that might have this problem.
Somehow the libkobold2d-ios.a file (along with a few others) were removed from the "link binary with libraries" section of build phases. I definitely didn't do that manually, so I don't know why they were missing, but when I added them back it worked.
A quick note - They will still show up as red, because they have to be built at compile time.

Resources