Xcode mach -o linker - ios

When i am trying to compile my project with NMSSH framework, XCode 5 says:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_NMSSHSession", referenced from: objc-class-ref in HelloWorldViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What should I do?

I ran into a similar issue myself. Here's what I did to fix it.
Open the downloaded Git repo in Finder
Open the NMSSH-iOS.xcodeproj file. NOT the NMSSH.xcodeproj!
Clean and build the project.
Follow the steps from the Github wiki page https://github.com/Lejdborg/NMSSH/wiki/Build-and-use-in-your-iOS-project
Actually, this itself is on the wiki page too. I know I opened the wrong Xcode Project and it seems like a lot of people do it accidentally. So, that's what I had to do to resolve it. Also, you'll have to build the framework for either the physical device or the emulator, depending upon what you're using and add to your project depending.
Hope this helps! Good luck!

You need to link NMSSH.framework with your project.
Open Build Phases in your project settings and add NMSSH.framework into the group Link Binary With Libraries.

Try this:
Click on the project then go to build settings and type linker flags in the search bar
Add "-ObjC" to "Other Linker Flags"

Related

Apple Mach-O Linker Error when Facebook installed using pods in the project

I have just installed the Facebook using pods and now my project is not working and says. Please help someone.
Apple Mach-O Linker Error
ld: 87 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
duplicate symbols for architecture means your files are doubled, Please check if you have added facebook framework manually before using pods
you can also check files duplicating by seeing whole description of error
Solution 1
You need to do this:
Click on your project (targets) Click on Build Settings Under Library Search Paths, delete the paths May be this will help you.
Solution 2
You have duplicate symbol method which means there are duplicate file in project
In your Target's Build Phase, under "Compile Sources" check if there are duplicate file and delete one if you have duplication.
Hope this will help you.

Venmo touch Braintree payment - compile error: Undefined symbols for architecture i386: "_OBJC_CLASS_$_VTClient"

I have successfully installed braintree ios sdk using cocoapod and It was compiled fine.
However, when I initVTClient in my appdelegate.m file. I was getting compiling error:
Undefined symbols for architecture i386:
"OBJCCLASS_$_VTClient", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
and I couldn't find any solutions online at all. any tips?
also submitted an issue here:
https://github.com/braintree/braintree_ios/issues/27
It's possible that you need to put "build settings"->architectures back to "standard architectures" since the old Venmo library (before their big v0 update) was built before the 64bit architecture. That's one solution I've seen.
[EDITED: 2/25/2014, 4:47pm EST]
I got my project to work. The problem for me was that my existing build settings were getting in the way of the build settings that cocoapods wanted to load onto the project. Those are the important ones such as the Venmo Framework, so there's good reason for the issue.
If you go to "build settings" -> "other linker flags", and add a new flag: "$(inherited)", it will work. I put that one at the top of the list so I'd try the same, not sure if order matters. What this does is keeps your old settings / flags, (I was using -ObjC), and imports the new ones from cocoapods. Good luck.
looks like i need to add VenmoTouch.framework into my target->Link Binary with Libraries.
then what's the point of using cocoapods
the official answer:
https://github.com/braintree/braintree_ios/issues/27
Make sure you verify which target CocoaPods is integrating with. There are a number of patterns for specifying this, such as target "name" do ... end and link_with.
See here for more details: http://guides.cocoapods.org/syntax/podfile.html#link_with

Cannot Archive when a library is included in my own iOS custom framework

I created my own iOS framework by following this tutorial, https://code.google.com/p/ios-static-framework/, which uses a static library template and aggregate target with a custom run script to create a framework.
At first it works fine. After including another library in the framework project creates the error when archive or build for device. I think the problem is with some wrong settings for that library. But I just don't know what to try. I have tried setting some sensible Other Linker Flags from https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ld.1.html , but no luck. Can anyone help please ;(
What steps will reproduce the problem?
Follow the tutorial, but change the Aggregate script architecture from armv6 armv7 to armv7 armv7s. Here is the part of the aggregate target script I changed. Everything else is the same.
if [[ "$SF_SDK_PLATFORM" = "iphoneos" ]]
then
SF_OTHER_PLATFORM=iphonesimulator
SF_ARCHS=i386
else
SF_OTHER_PLATFORM=iphoneos
SF_ARCHS="armv7 armv7s"
fi
Add an external library to the project, here I use libBlocksKit.a.
Build the framework, success.
In another child project. Include my built framework.
Add -ObjC in the app Target > Build Settings > Other Linker Flags
Archive and get error. Building for device (iPhone5) gives error too. But building for simulator seems to work.
What is the error?
This error, basically "ld: warning: directory not found for option ... ld: lto: could not merge in ... symbol multiply defined!".
ld: warning: directory not found for option '-L/Users/hlung/Dropbox/- Notes/stackoverflow/RealFrameworkApp/RealFrameworkApp/External/BlocksKit'
ld: lto: could not merge in /Users/hlung/Library/Developer/Xcode/DerivedData/RealFrameworkTest-evagqzwzyyolhjenkkjbvzibxppf/Build/Products/Debug-iphonesimulator/RealFrameworkTest.framework/RealFrameworkTest(NSObject+BlockObservation.o) because 'Linking globals named 'OBJC_CLASS_$_BKObserver': symbol multiply defined!', using libLTO version 'LLVM version 3.2svn, from Apple Clang 4.2 (build 425.0.28)' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I archive my child project with only one architecture (like armv7), it works. It shows this error with armv7 armv7s architectures ( $(ARCHS_STANDARD_32_BIT) ).
What version of the product are you using? On what operating system?
OS X 10.8.5, XCode 4.6.3
== Update 1 ==
Posted an issue at the tutorial's code.google.com page Update: 2 weeks no answer.
I found a set of useful suggestions from this answer. Update: Doesn't work
I have created a project so you can run and see for yourself here
Linking against a static library from within a framework can create some interesting challenges... It sounds like you may be linking to BlocksKit from both your framework and your application projects.
You should link in only one of those places. Try removing libBlocksKit.a from the Link Libraries build phase of your framework, but leave it in the other project.
You can do like this:
Click on your project (targets)
Click on Build Settings
Under Library Search Paths, delete the paths
I hope it can help you.

Moved Xcode project has missing files from other libraries

I moved the folder of a project in Xcode to another computer, and I"m having some issues. I'm using NMSSH framework, and the libz.dylib file is missing from the project, and I'm unable to locate it, since the Inspector button for it is grayed out. The file is not on my system either. Shouldn't it have been inside my project folder?
Also, I'm using MBProgressHUD, and I'm using it by dragging its Xcode project in, and setting the appropriate links. One of the libraries libMBProgressHUD.a is missing, and I can't locate that either.
Everything was working fine on my other computer, so I'm guessing there's a problem with search paths, etc? Any help would be much appreciated. The errors are as follows:
ld: warning: directory not found for option '-F/Users/ramesh/Documents/CodeDump_Temp/iOS/RasbPiController/../../.Trash'
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_NMSSHSession", referenced from:
objc-class-ref in UserPi.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
you can download the missing file from the link below
https://www.dropbox.com/s/au2irnctslcpjih/libz.dylib
and paste it in your iOS Simulator folder. I hope it will work .

Undefined symbols in Xcode

I'm getting this error when building in Xcode for iOS.
Undefined symbols for architecture i386:
"_CGRectInset", referenced from:
-[RootViewController viewDidLoad] in RootViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The app is a clean project, just built from the template Xcode provides.
Any ideas?
I had the same problem with a project created from "Page-Based Application" template, in XCode4 Developer Preview 5.
You can fix it by adding the CoreGraphics framework to the list of linked frameworks and libraries. In other words:
Select the project file in the navigator (left-pane)
select the app target (the only other one is a testing target)
In the summary tab, scroll down to "Linked Frameworks and Libraries"
Hit the + andd CoreGraphics.framework.
Then it builds and runs.
This may be due to the project not being linked to the correct libraries. It may also be that there are missing Frameworks on your SDK installation. In the Build Phases section, make sure that your app is linking with UIKit and CoreGraphics. Also, it may help to also add the QuartzCore Framework, although I doubt that that is needed.

Resources