Undefined symbols for architecture x86_64 with known good framework. - ios

XCode 7.2.1
iOS 9.2 SDK
I compiled Mobile VLC Kit into a .framework for all architectures quite some time ago and have been successfully using it in one project with no issues. Now I want to use it in a new project and I'm unable to build due to error "Undefined symbols for architecture x86_64" referencing pretty much every function in VLC.
This is a mixed swift/objective C project however I'm not referencing VLCKit from the swift side. The only think referencing VLC is legacy objective C code that has been working fine with this framework in another project.
Target memberships are correct.
Framework search paths are set and verified correct
Build Active Architecture only yes/no doesn't make any difference
32bit Simulator (iPhone 4S) and 64bit Simulator (iPhone6) show same problem.
Problem seems to happen wherever I import the framework, even if I'm not calling any methods on it. Even if I remove the Objective C classes that use VLC Kit and ONLY impo
I tried copying the framework into the project rather than referencing it but it doesn't make a difference.
Compared settings from previous project and I can't see any difference.
Framework is in "Link Binaries with Libraries" list.
I'm at a loss here.

I just spent a ton of time with the same error. It all boiled down to not having a Host Application set for my Unit Test and "Allow testing Host Application APIs" wasn't checked. Once I set it like in the image, it finally stopped producing errors. Hopefully this is the solution for you as well.

Related

Undefined symbols for architecture x86_64: xcode 9 Swift 4

I create app that uses Huawei SDK written in Objc with updated docs in Oct 2017. But when I add framework to project, this shows me stange error. I have stack on this problem couple days, I have tried everything from similar problems, but nothing helped for me.
Framework added correctly(header file, link binary with libraries) autocomplition works well and shows the methods when trying to use SDK.
Already tried: change/edit/update
Valid architecture: arm, armv, armv7, armv7s, i386, x64_86
Clean Derived date and achieves
Restart OS
Change swift version: Shows another error
Checked ObjC bridging header
Pod update/install
Framework search path
SOLUTION:
Launch on real device=)
Looks like your HWMobileSDK.framework is not a fat framework. You'll either need to find a fat framework, or a second build of the framework that's compiled for the simulator (x86_64). I couldn't find any reference to that framework online, so it looks like it's not publicly available. If you got this from Huawei directly, you should ask the person you're in contact with there. Either they don't provide a version of the library for the simulator and you'll need to develop using a device only, or you need another version of the library.

Objective-C Xamarin Binding not working on device

Hello Guys I'm trying to make a Binding for our Objective-C SDK, I follow the steps in the Xamarin walkthrough it works on simulator but not on device, what could be the problem knowing that I'm using Xcode 6.4, I also use a Fat library (one that contains the builds for i386 and armv7 architectures).
I've tried cleaning and rebuilding the project, and also added the -v-v-v as additional builds parameters but nothing!!! All i'm getting is this error message :
Failed to load Aot Module
On Xamarin forums they say that it gonna work if you just clean the solution. So if it doesn't help, try removing all the "bin" and "obj" folders in all the projects and build again. If even that doesn't work you should probably consider it as a bug and write to their support.

How to build iOS framework with XCode 6

I know of familiar tutorials on this, but introduction of framework XCode 6 template has changed the game.
I already watched WWDC 2014 video about building modern frameworks but it talks more about building extensions, framework & app all inside single project. It does not specify if the framework I make with it is truly reusable across any project.
I am building framework the XCode 6 way (File->New Project->Framework and Library->Cocoa Touch Framework), but when I import it inside my test app project (separate from framework project) - I keep getting various errors.
Example: Include of non-modular header inside framework, and so on.
I know this is not what it says, and there are quite some missing steps in whatever I am doing. The older tricks may have worked for everyone, but I simply don't find which way to follow after XCode 6.
For example, there is some folder structure that a framework needs, but XCode 6 doesn't comply to it while building it. Is it right? If not, how can I change the way the XCode builds framework folder hierarchy?
Do I go back to old school or am I screwing some tiny thing in XCode 6 that I am unable to create a reusable framework?
I am not sure if you are trying to build a framework with Objective-C or Swift as your question doesn't state it. I've encountered errors you are mentioning with Swift so I'll give you my method to build Swift frameworks.
I found the process for Objective-C to be very straightforward and well documented, so I'll skip this.
As for Swift, there are a few things to consider. First, Swift static libraries are not supported, so you must exclusively use a framework (aka dynamic library) when linking an app to a library.
Here are the steps:
Create the Framework using New > Project under IOS > Framework & Library, select Cocoa Touch Framework
To avoid the "ld: warning: directory not found for option..." goto Library Search Paths in Build Settings for your target and delete the paths.
You can't mix Objective-C with Swift so don't even consider adding the Swift-Header bridge file in your code.
There are some cases in swift where you need to import code from unexposed Frameworks. I've successfully used the module-map inside the framework to deal with these case.
I also select CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES in the Build Settings to solve 'include of non-modular header inside framework module'. That seems to work
I make sure that the header file that gets generated is marked as Public (not Project). Click on the file and you'll see the selection in the inspector under 'Target Membership'
You may run into some bizarre error messages when building. Xcode has a tendency to report linker errors when your code can't compile correctly resulting in missing files the linker needs to output its binaries. Sometimes XCode won't show the errors in the files you are compiling and you need to go manually on the build output and go back to the files. Some other time, you'll get a problem where you need to delete the cache. Those issues I call XCode blues and deal with it constantly. I found this type of problems happens more often when building libraries. The rest should work as expected.

iOS: SpriteKit works even not linked?

In Xcode 5, I create a game demo using Xcode's 'Game Template', it links frameworks like this:
It use SpriteKit's code, but if I remove the SpriteKit.framework, it works too. I also use CoreMotion and find it not work without link CoreMotion Framework.
Then I create a game demo using Xcode 6, it doesn't link any framework now:
But it also works.
So there is no need to link frameworks?
I mainly using Xcode 5. Without linking how can I set it to 'Optional' to not crash on iOS6 ?
Okay, so this is basically a recollection from memory, correct me if I'm wrong.
Xcode can determine at compile time which (Apple) frameworks are referenced and links with them. It can also determine which other targets the main app target references.
However there's the possibility that this isn't quite true and since you've already built the project once with all the frameworks linked, the temporary build files make it so that the build with an empty Link Binaries list still works. To verify that, run a Product -> Clean in Xcode, then build & run again.
I'm not sure about using an optional framework. Either those frameworks are implicitly optional, or the whole point of adding them to the Link Binaries list is to be able to set them as optional.
A quick test with iOS 6.0 or earlier Simulator should help you find out which way it is.

Xcode - debugging library built outside project

I have a C library whose code resides in say /repos1/clib. I build that from the command line using the latest iOS sdk to create clib.a (including a debug build for the simulator) which I copy to an iOS project say in /repos2/proj.
I have been using this setup for several years. The old C library very occasionally might require some debugging and I was pleased by the fact that Xcode simply stepped into the library code that was outside the project (inside repos1) without having to do any setup - it just worked.
But this was up until a few Xcode versions ago. I am not sure exactly when it changed - perhaps when they moved from gcc to llvm? - since I very seldom needed to debug the C code, but for a while now I only get dissasembly when I try to debug the C library from the iOS project (including at least references to the C file name & line number). For the few times I need to debug it is very inconvenient (I create a temp project that includes the C code).
So, any idea why it worked before and doesn't now? Where should I look? Could it be the way I build the C library, maybe there was a flag in gcc I was using that does not have an equivalent in llvm (I can find and post the old build command I was using if it is relevant)? Is the issue in Xcode and there is a way to tell it where to look for the sources?
Thanks!
Edit: To make it clear, I can add the C library either as the source or as a subproject in Xcode, however for reasons that are out of scope this is not helpful for this specific project. So, can it work like it used to with older Xcode versions? If not, it would still be interesting to know why not.
The recommended approach is to create a library project in Xcode, one for iOS (there is a template for it), then when you get that to build add that project to your app, make sure the lib is a dependency and gets linked. There are many tutorials on the web how to do this.
Then as iOS evolves and new architectures (armv7s) arrive you simply update both projects.
I was struggling with the same issue.
I tried resetting in library/application project all options related to symbol stripping and copy application project to same truecrypt drive as library project but it didn't help.
In my case it appeared it was an app project issue. Same library could be debugged in another app project with source code so that was a clue.
I had more than one version of the same library in app project and set only target membership to choose which should be used. Not sure if that could affect my app project somehow.
Nevertheless after deleting all libraries and copying them to app project again I was able to debug libraries with access to source code.

Resources