Undefined symbols for architecture arm64 in Xcode - xcode

I have a framework Xcode project A, and an app Xcode project B that uses the framework binary of A.
When I try to instantiate an object of my framework in my app, it gives me this link error :
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
My framework is arm64, I verified with lipo -info .
The symbol _OBJC_CLASS_$_MyClass is in the framework, I verified with nm mylib | grep MyClass
I don't understand how it is possible that this symbol is not found.
What could be the cause of this ? Any help would be appreciated, thanks a lot..

I solved my issue by setting Symbols Hidden by Default to No in the build settings.
Or, I could also add __attribute__ ((visibility("default"))) in front of my class if I wanted to keep that option and hide all other symbols.

Related

Xamarin.iOS Framework binding + FastPdfKit

I have a static library (.a) whose include "FastPdfKit.framework". (My Xcode project runs correctly)
This static library is included in xamarin project and i have to bind "FastPdfKit.framework".
So i did: project options -> iOS Build -> Additionnal mtouch arguments (--framework:${ProjectDir}/frameworks/FastPdfKit.framework).
But this mani doesn't run, i've got linked error:
ld: warning: ignoring file
/Users/../Documents/XAMARIN/MyApp.IOS/frameworks/FastPdfKit.framework/FastPdfKit,
missing required architecture arm64 in file
/Users/../Documents/XAMARIN/MyApp.IOS/frameworks/FastPdfKit.framework/FastPdfKit
(2 slices) Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MFDocumentManager", referenced from:
objc-class-ref in MyLib.a(Page.o)
"_OBJC_CLASS_$_ReaderViewController", referenced from:
objc-class-ref in MyLib.a(Page.o)
ld: symbol(s) not found for architecture arm64 clang: error: linker command failed
with exit code 1 (use -v to see invocation)
MTOUCH: error MT5209: Native linking error: warning: ignoring file
/Users/../Documents/XAMARIN/MyApp.IOS/frameworks/FastPdfKit.framework/FastPdfKit,
missing required architecture arm64 in file
/Users/../Documents/XAMARIN/MyApp.IOS/frameworks/FastPdfKit.framework/FastPdfKit
(2 slices) MTOUCH: error MT5211: Native linking failed, undefined
Objective-C class: MFDocumentManager. The symbol
'_OBJC_CLASS_$_MFDocumentManager' could not be found in any of the
libraries or frameworks linked with your application. MTOUCH: error
MT5211: Native linking failed, undefined Objective-C class:
ReaderViewController. The symbol '_OBJC_CLASS_$_ReaderViewController'
could not be found in any of the libraries or frameworks linked with
your application.
MTOUCH: error MT5202: Native linking failed. Please
review the build log.
Can anyone help me???
Thanks,
Yann
OK, i found.
It was architecture problem. I don't know why because I set architecture option correctly, but not all of architecture setting was generated
Use command line "xcrun -sdk iphoneos lipo -info MyLib.a" to check which architecture is generated.
The error is really very clear, the librarty doesn't support the arm64 architecture as is requested by the project, you need a library compatible with your project's architectures.

Getting an error : Undefined symbols for architecture x86_64

I'm trying to write a C file from the tutorial in my cocoa project however, I'm getting errors like
Undefined symbols for architecture x86_64:
"_IOIteratorNext", referenced from:
_MyGetDeviceFilePath in USBInterceptor.o
"_IOMasterPort", referenced from:
_MyFindEjectableCDMedia in USBInterceptor.o
....
Does somebody know what's wrong?
The error suggests that you need to add the IOKit framework to the link step of your project's build phases.

Xcode5, project deploys to device but get's a build error for simulator

When I deploy my app to my phone via xcode5 it works find, however when I try to deploy it to one of the simulators I get the following errors.
ld: warning: ignoring file /Users/benpearce/Downloads/MapKit.framework/MapKit, missing required architecture i386 in file /Users/benpearce/Downloads/MapKit.framework/MapKit (2 slices)
Undefined symbols for architecture i386:
"_MKCoordinateRegionMakeWithDistance", referenced from:
-[MapKitView createViewWithOptions:] in MapKit.o
"_OBJC_CLASS_$_MKMapView", referenced from:
objc-class-ref in MapKit.o
"_OBJC_CLASS_$_MKPinAnnotationView", referenced from:
objc-class-ref in MapKit.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone see what's going on?
The MapKit framework is missing a binary for the Simulator which is i386. The Simulator is a Mac application and needs a code resource compiled for the i386 Intel processor. Where did you get MapKit?
If this is Apple's MapKit you should just be including the framework provided with Xcode. It is added in Xcode by selecting the Project, Build Phases, Link Binaries with Libraries, +, select MapKit.framework.
Also the framework in in your Downloads directory, why?

Zxing 'undefined symbols for architecture x86-x64' error

I use zxing lib in my OS X application. I've included zxing-objc to my project and simply copy-pasted code from zxing demo (zxing-root/objc/examples/demo) to the separate ViewController class. When trying to compile project, I get the following linker errors:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_QTCaptureDevice", referenced from:
objc-class-ref in ScanViewController.o
"_OBJC_CLASS_$_ZXCapture", referenced from:
objc-class-ref in ScanViewController.o
"_QTMediaTypeMuxed", referenced from:
-[ScanViewController performVideoSourceScan] in ScanViewController.o
"_QTMediaTypeVideo", referenced from:
-[ScanViewController performVideoSourceScan] in ScanViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've carefully checked all code and compared my project properties (including c++ compiler options) to demo project properties, and everything is done right.
You need to add the necessary frameworks to your app target. You can look in the sample app for an example. Select the target in Xcode, select Build Phases, and open the Link With Libraries entry. You'll see that it includes both QuartzCore and zxing-objc-framework. It sounds like you don't have those in your project.

Undefined symbols for architecture i386: "_OBJC_CLASS_$_SDZInfo" (sudzc)

I'm developing an application with XCode 4.1.1
I added the library from http://sudzc.com/ for consume web services.
When I compile the application, it gives this error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SDZInfo", referenced from:
objc-class-ref in SimpleTableViewAppDelegate.o
objc-class-ref in RootViewController.o
"_OBJC_CLASS_$_SoapFault", referenced from:
objc-class-ref 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 configuration of XCode is Build 2.4 and Deplo yment Target 5.1.
This solution does not working for me because SimpleTableViewAppDelegate.m and RootViewController.m are added "You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually"
Thanks in advance for your help.
The error is saying that the missing files are the ones that contain SDZInfo and SoapFault. The two .m files you mention must already be in the project because they are listed as the places where those things are required.

Resources