add framework to static library xcode - ios

i am trying to add this mpos.framework to my Static library but i get this :
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MPMpos", referenced from:
objc-class-ref in libSerenity.a(Widget.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i should add the mpos.framework to the DependentApp also?

i should add the mpos.framework to the DependentApp also? - You can easily answer this by trying it.
My guess is that this is not your problem. It looks like mpos.framework (and its internal library) is not FAT library and is compiled for ARM architecture(s) only. It probably do not contain i386 (simulator) version of the compiled code. You can find more information about FAT libraries here: Build fat static library (device + simulator) using Xcode and SDK 4+

Related

Undefined symbols for architecture x86_64 while using a static library

I created a static library (XXX.a) (which has 3 static libraries inside(aaa.a, bbb.a, ccc.a)) and added it into a pre-developed project (someonesProject). When I lipo -info to XXX.a I see the following architectures: armv7, i386, x86_64, arm64
When I try to run this project, I receive an error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_aaa", referenced from:
objc-class-ref in XXX.a(XXX.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I remove arm64 from the valid-architectures (arm64, armv7 armv7s) of the project (someonesProject), then I can run the app.
How can I fix this issue, I want to make this project work without removing arm64?
I really need help.
Thanks
E.
All your static libraries have to be compatible with arm64 if you want to compile your project with this architecture.
So I guess at least one of aaa.a, bbb.a and ccc.a is not compatible with arm64.

Linker error for echoprint in iOS

I'm using echoprint API for song search from last 3 months. But suddenly it started giving me below errors. Already I have face many problems while adding that API to my project & now it start giving me linker error. It was working for me previously.
Error like this:
"Codegen::Codegen(float const*, unsigned int, int)", referenced from: _GetPCMFromFile in File.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: symbol(s) not found for architecture i386
ld: warning: directory not found for option '-L-L/Users/prajaktakulkarni/Downloads/echoprint-codegen-4.12 2/src/echoprint-codegen-ios/build/Release-iphoneos'
ld: warning: ignoring file /Users/prajaktakulkarni/Documents/Instajam/libechoprint-codegen-ios.a, missing required architecture i386 in file /Users/prajaktakulkarni/Documents/Instajam/libechoprint-codegen-ios.a (2 slices)
Undefined symbols for architecture i386:
"Codegen::Codegen(float const*, unsigned int, int)", referenced from:
_GetPCMFromFile in File.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The error message is saying that the static library libechoprint-codegen-ios.a hasn't been built for the i386 architecture - which is the architecture used by the simulator.
You can find out which architectures the static library has been built for by running the following code in Terminal:
lipo -info ~/Documents/Instajam/libechoprint-codegen-ios.a
It will likely tell you it is built for armv7 and armv7s. That will support all but the oldest iOS devices at the time of writing.
You could build libechoprint-codegen-ios.a to run on a simulator. Here's a good stackoverflow post if you are interested in doing that: Build fat static library (device + simulator) using Xcode and SDK 4+
The easiest option would be to just plug your phone in and not worry about building a fat static library. :D
Recently the problem was fixed for me by using libz.1.1.3.tbd instead libz.tbd and of course this link is useful Echoprint iOS Missing Framework

iOS Static Library Xcode (linking errors)

I created a static library with Xcode I have compiled selecting a device.
I added this to my library test project in Xcode 4.6
but I always have 2 errors during the linking...
I followed this tutorial: Static Library iOS Tutorial
if I download the sample code I have the same errors:
ld: warning: ignoring file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a, missing required architecture i386 in file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MathFunctions", referenced from:
objc-class-ref in MathTestAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I had once made a static lirary , I had the same problem .
Solution was to "Run the app on device " not on simulator , it works fine then !!!
Hope this helps...
I followed this step by step tutorial:
Tutorial
in particular I had to add these flags: -ObjC and -all_load
You must have selected iOS simulator while building the project. Select iOS device and it should be fine.
Do read and try to understand the error message, it's a meaningful English phrase.
symbol(s) not found for architecture i386
So there's no compiled code for the i386 architecture in the library. This means that either it's compiled for ARM only (for actual iOS devices, like iPhone or iPad), or for the 64-bit simulator (x86_64). Use otool to find out the architectures present in the library.

xcode4 zxing : Undefined symbols for architecture i386

I need to incorporate QR in my app, im using zxing,
the scan test works wonderfully, and when importing the widget after following all instructions, all goes fine,
but
I have this errors when implementing the code for the widget and QRCodeReader
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ZXingWidgetController", referenced from:
objc-class-ref in AttendanceVC.o
"_OBJC_CLASS_$_QRCodeReader", referenced from:
objc-class-ref in AttendanceVC.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
so how to fix this please?
edit:
my Architectures on build settings is: i386 armv6 armv7
thanks a lot!
Double check step 2 in the README. Under Link Binary with Libraries you must have libZXingWidget.a and it sounds like you don't.
Check the Valid Architectures in the build settings. Check out these links.
Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error
Undefined symbols for architecture i386
EDIT : Usually these type of linker errors occur due to the link issue in your compiler or link issue with your added frameworks or your libraries. check whether you are using a suitable compiler, check whether you have added all the required libraries and frameworks. Also check whether you have imported all the libraries and frameworks properly. Please check all these things too once. For guidance on this check the below links
http://forums.macrumors.com/showthread.php?t=956090
Apple Mach-O Linker Error when compiling for device
Linker error (only simulator) with own library after update to iPhone SDK 4.0
clang: error: linker command failed with exit code 1
Hope This Helps..
I had the same issue and following configuration in "Build Settings" works for me.
C Language Dialect: GNU99 [-std=gnu99]
C++ Language Dialect: Compiler Default
C++ Standard Library: Compiler Default

error when including my static library in an iOS project

I'm trying to include a static library in an iOS project.
I imported the .a file and every .h related but then I'm getting this error :
ld: warning: ignoring file /Users/alexis/Library/Developer/Xcode/DerivedData/PlazappPartnerWorkspace- cdrmloavlcqouugawmtqywiinqne/Build/Products/Debug-iphoneos/libPlazappPartnerLib.a, file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_LauncherViewController", 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)
I guess there's a problem of architecture type but I don't understand why nor how to solve it.
Can someone explain it to me and tell me how to solve it? Thanks!
It seems your library was built to run in the device (arm architecture) and you try to use it in the simulator (i386 architecture). Check your library build settings. They should match with your project build settings.
Or even better, create a fat library for development purposes. lipo command is your friend.
To verify the current architectures present in your library: (in Terminal)
cd <path to library folder> # in you case: /Users/alexis/Library/Developer/Xcode/DerivedData/PlazappPartnerWorkspace- cdrmloavlcqouugawmtqywiinqne/Build/Products/Debug-iphoneos
lipo -info libPlazappPartnerLib.a
The output should look like:
Architectures in the fat file: libPlazappPartnerLib.a are: armv6 armv7
They should match with the target device or simulator you are building for.

Resources