Xcode - Missing Architecture (library linking) - ios

For the recent couple of days I have had this compiler error in Xcode every time I've built my project:
ld: warning: ignoring file /.../(Framework Name).framework/(Framework), missing required architecture x86_64 in file /.../(Framework Name).framework/(Framework) (2 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_CLSNAME", referenced from:
objc-class-ref in ViewController.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 also can't run this code on the iPhone 5 simulator (i386).
The iPhone device I have is outdated and can't run iOS 8. I tried setting the build settings to iOS 7 but I get an error regarding the lack of support for dynamic libraries before iOS 8.
Things to note:
I am using 2 projects, in 2 different workspaces. (one for the library and one for the demo app. Tests of the same code with the unit tests in the library project are successful.)
I used to be able to link the demo project with the library project until I had to do some changes in the library code. After I exported the newer version this error started occurring.
In order to get the library file/folder (.framework) I used the Archive option.
Running lipo -info outputs Architectures in the fat file: lib.a armv7 arm64
I have C++ code in the library project (unlikely to be the issue)
In the library project, I am using another external library I installed with Cocoa Pods (also used to work before changes in the library code)
Solutions I tried:
Changing the Architectures and the Valid Architectures list in Build Settings.
Setting "Build Active Architecture Only" to "No" in Build Settings.
Creating a new project (both for the demo and the library)
Making the library a static library (new project, got the same warning, no error, couldn't #import the files I needed)
I only started working with iOS and Xcode a couple of months ago and I am not super-experienced with everything there yet, so please try to explain everything with as much detail as you can.
Thanks in advance to anyone trying to help :)

Did you add the framework it says is missing? Also, try to delete the Derived Data folder and then clean the project. If that does not work, then turn off Modules in build settings.

Related

Mac : symbol(s) not found for architecture x86_64

I'm trying to build a mac application which is going to use one static library.
I created one workspace and added my application project and static library project to workspace and added linked application framework or libraries to my result library.
I'm able to compile my library project individually and able to get .a file out of it. But when i run the application, I'm getting linker error saying symbol(s) not found for architecture x86_64
I verified valid architectures in app and static lib projects. both having i386, x86_64
Can any one help me on this.
Thanks for understanding the problem.

Undefined symbols for architecture i386: "_OBJC_CLASS_$_CkoCsv"

I am Developing iPad App in my app read and write csv File.
csv file read and write for using Chilkat library but I am getting this error.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CkoCsv", referenced from:
objc-class-ref in backGroundViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can resolve this problem ?
Please Help me.
thanks
Check Chilkat library info.Check with terminal
lipo -info library(drag library to here).
I think library not build for simulator.If you have the source code built it for simulator also.For further verification check with real device.
Use the Chilkat support forum by searching. I found this instantly:
This happens if you are trying to link your simulator build against
the device static lib. Chilkat provides two separate static libs for
IOS apps. One targets the actual IPhone/IPad device and the other is
for the simulator. Both libs are named "libchilkatIos.a". After
unzipping, the simulator version will be located in the "libSimulator"
directory, and the device version will be located in the "libDevice"
directory.
When building for the simulator, make sure to use the simulator lib.
When building for the device, make sure to use the device lib.
It is easy to create a single universal lib using libtool. For
information about this, see
http://www.chilkatsoft.com/chilkatIos.asp
You need to import "libchilkatIos.a" file to your project. Just right click on any class file, Add files to-> and then select "libchilkatIos.a" file from lib->i386 folder in your Chilkat directory. Now the error will go away.

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

How to Use LibXtract with iOS project?

I am trying to extract some features from audio files, MFCC to be accurate. Then I found a C library LibXtract, that would do the job for me.
I am trying to use LibXtract in iOS project, I have followed this tutorial
http://inote.apptrek.net/2011/10/howto-compile-native-c-codes-to-a-library-for-ios-development-in-xcode-take-mosquitto-for-an-example/
but I got some problems in process, first I got this warning
ld: warning: ignoring file ......./libLibXtract.a, missing required architecture i386 in file ..../libLibXtract.a
and those errors
Undefined symbols for architecture i386:
"_xtract_asdf", referenced from:
-[VoiceRecAppDelegate applicationWillResignActive:] in VoiceRecAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I would like to ask for your help in this problem, I would like to extract the MFCC from scratch with only obj-C code if possible.
Regards,
Omar
It sounds like you are trying to build your application with the Simulator as a target, but the LibXtract static library was not built for the i386 architecture.
You can confirm this with:
lipo -info /path/to/libxtract.a
The result from lipo should list the i386 architecture.
If it doesn't, then check that iphonesimulator is included in the Supported Platforms build setting in your LibXtract Xcode project and that i386 is included in the list of architectures.
It is also possible to compile autotools-based libraries for iOS/Simulator from the command line. Some instructions for this can be found here. Note: these are a little out-of-date so some of the options may need tweaking, although the principle remains the same.
However, it is far simpler to compile LibXtract into your application by dragging the LibXtract sources into your application's Xcode project!
I generally tend to have a "Libraries" group in my projects, under which I place third party sources (like LibXtract), as follows:
When dragging the files into your project ensure that you check the checkbox for your application in "Add to targets".
The LibXtract sources will then be compiled into your application and you can remove libxtract.a from your linker settings (or frameworks).

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.

Resources