Missing required architecture x86_64, i386 - ios

I am trying to build an Application where I have already source code with me and which is not developed by me. I the project seems using a static library testlib.a and I can see the in the project the library contains only header and the pre-compiled library testlib.a.
And the problem is when I trying to build the source code,
I am getting following error like,
testlib.a, missing required architecture x86_64
testlib.a, missing required architecture i386
undefined symbol for architecture x86_64
undefined symbol for architecture i386
Does the above means, I cannot use the pre-compiled static library which already included with the project?(The main problem I am going to face here is I don’t have the source code for the library if I have to rebuild it to create universal library).
How can I resolve this issue?.

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.

iOS unit test with OCMock static library (the -ObjC flag issue)

My project is developed with Objective-C. I have a third party framework in use (I name it thirdparty here. Sorry, I can't tell the name of the third-party).
Now, I want to write unit test code for my project. I use OCMock static library & I followed its instruction to setup this static library to my iOS project. As you see in their instruction, it asks me to add the -ObjC linker flag in Build Settings -> Other Linker Flags.
But when I build my project I get the following error:
ld: warning: Auto-Linking supplied '../thirdparty.framework/thirdparty',
missing required architecture i386 in file ../thirdparty.framework/thirdparty (2 slices)
But, if I remove the added -ObjC linker flag from Build Settings -> Other Linker Flags, the above error disappears, my project then can be built successfully (but when run my unit test, OCMock library throws error which asks me to add the -ObjC linker flag back)
Regarding the error, I assume that your 3rd libs do not support i386 architecture. I guess that you experienced that issue when running on Simulator. You should check again whether or not your libs support the targeted architecture. Here is the script to check
xcrun -sdk iphoneos lipo -info $(FILENAME)
The result shows like this
So I think the issue might not come from OCMock static lib as long as it supports i386 architecture. You should check again your configuration or other libs as well.

Xcode 7 missing required architecture arm64 in file

I started a new project and Added an SDK and got this warning:
ignoring file libLineaSDK.a, missing required architecture arm64 in file libLineaSDK.a (3 slices)
my question is how do I add the required architecture in Xcode 7...either blind because I dont see it.
UPDATE
I was able to find the architectures in build settings and I see arm64 is one of the listed artchitectures, so now I have no idea how to fix this issue.
You have to recompile libLineaSDK.a with arm64 turned on. If it's a third-party library, you'll have to ask provider for a 64-bit compatible version.
Use
otool -hv /path/to/libLineaSDK.a
If your architecture is not among the listed, compile the lib again but for the respective architecture.
If the architecture is listed, check your library path, it may point to a different version.

Xcode - Missing Architecture (library linking)

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.

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).

Resources