Undefined symbols for x86_64 - iOS - 64-bit transition - Xcode6 - ios

I apologise for a dumb question. I really had tough time with this.
I am now, converting my existing code to support 64-bit. My app uses few frameworks
(I use kstenerud/iOS-Universal-Framework)
And I get this error.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MyFrameworkClass", referenced from:
objc-class-ref in MyUI(iPhone_MyVC.o)
MyFrameworkClass is defined in my framework, Which I built using the below settings
In my project, I use this framework and have the same build setting as above.
I am sure, I have the same setting throughout. But still I get this error. Am unsure, what else Am I missing.

You can build the static library for individual architectures and then 'lipo' them together.
Check out the excellent article here: http://blog.diogot.com/blog/2013/09/18/static-libs-with-support-to-ios-5-and-arm64/

You are building your lib for arm only, then you try to run it on x86 (simulator).
Make a lib that supports x86 (64) and use that for debug, the one you have for production.

You should include more of the error message for better help, but it looks as though whatever is providing the MyFrameworkClass class doesn't have a simulator x86_64 slice.
With Xcode 6, you update your project to use Xcode's provided framework target instead of using kstenerud/iOS-Universal-Framework

Related

I can't build dlib library on xcode

I'm trying to use dlib in ios so I can run an application using face recognition
I'm following this link to build dlib for ios then the error below shows up.
Undefined symbols for architecture arm64:
"_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_", referenced from:
_dlib_check_consistent_assert_usage in DlibWrapper.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My environment
Mac (OSX) Catalina 10.15.4
SwiftUI (working with)
XCode 11.4
iPhone 6S
IOS 13.4.1
I'm afraid your title is a little misleading. You're not trying to build a library - you've downloaded a precompiled library and are trying to use it in a way it wasn't meant to be used. The library in question was not built for Intel architecture, so it won't run on the simulator. You have a number of options on how to proceed:
You can look for binaries with the appropriate architecture
Find the source code to the library (perhaps in a git project) and compile the libraries yourself
or look into Apple's Machine Learning Libraries and Technologies
https://developer.apple.com/videos/play/wwdc2019/209/
https://developer.apple.com/videos/play/wwdc2018/703/
Check out these and other WWDC videos on machine learning and ARKit as a starter.
I recommend you download Apple's own Developer app from the App Store.
https://apps.apple.com/us/app/apple-developer/id640199958
You can use it to find many videos on available resources.
There are a number of very powerful tools available. It helps if you know python, since that's where a lot of the development work is happening.
Maybe it would help if you were to look into how things are done in the iOS environment so you can better understand how it relates to other platforms.
There are many helpful articles out there, this is the first one I found:
https://towardsdatascience.com/core-machine-learning-for-ios-developers-7f2a4b19ec08
The key is to not get discouraged! There's a lot of useful information out there and it's important to look for alternatives when you've gone down a dead end.
Good Luck! 🍀

How to include C library (VLFeat 0.9.21) in iOS Project?

What are the necessary steps I need to take to compile VLFeat (an open source C library) and include it in my iOS project? Here is what I found out so far:
I am not too familiar with the compilation and linking procedures, but from what I currently understand, I need to compile VLFeat for the arm64 architecture in order for it to run on the iPhone.
There is a severely outdate guide on how to include VLFeat in XCode:
http://www.vlfeat.org/xcode.html
But when I follow these steps I get the following error:
Undefined symbols for architecture arm64:
"_vl_get_printf_func", referenced from:
-[OpenCVWrapper createMatrixFromImage:] in OpenCVWrapper.o
ld: symbol(s) not found for architecture arm64
I suspect this is because the library is actually built for OSX (hence for a different architecture). I have not been able to figure out how to build this for iOS (arm architecture) and get it running on a physical iPhone.
When I open the XCode project that is included in the VLFeat download and go to build settings for one of the Targets and change the Base SDK to iOS and Supported platforms to iOS and Valid Architectures to arm64 and then try to build, a bunch of errors come up for the VLFeat source code such as:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/mmintrin.h:64:12: Invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
and
"Compiling with SSE2 enabled, but no __SSE2__ defined"
These errors make me suspect that actually its not possible to build this library for arm and that, short of porting the library over (modifying code), it is an impossible task. I am not sure whether the conclusions I reached are correct so any input on this would be helpful.
The VLFeat library does not currently (January 2023) support ARM architectures, and seems to no longer be maintained, as the last commit was in January 2018.
However, this commit to a copy of the library updates the host.h and host.c files to add basic support for the Clang compiler and ARM architectures. This has enabled me to compile binaries for the Apple M1 Pro processor running MacOS, and these perform as expected.
Performance will not be as good as on Intel CPUs because the SIMD Neon instruction set for ARM is not yet supported, whereas SSE2 (on Intel) is.

Sphero with iOS 7

I'm having trouble with Sphero and iOS 7. Like it said to on the quick start guide, since the 1.6 release notes which were supposed to have instructions for starting a new project did not have said instructions, I used the "integrate into an existing project" tab, I set my deployment target to 6.0, brought in all the frameworks, and added the linker settings. When I launch it, I get this error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_RKMCStop", referenced from:
objc-class-ref in RobotKit(RKMacroObject.o)
"_OBJC_CLASS_$_RKMCWaitUntilStop", referenced from:
objc-class-ref in RobotKit(RKMacroObject.o)
objc-class-ref in RobotKit(RKRobotControl+MacroAdditions.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anybody help me? I would appreciate it a lot! Thanks in advance,
Joe
I guess I was wrong in assuming "The examples in this guide were built using Objective-C and have been tested with the current released OS and current version of Xcode" meant that the API was tested for the current version of iOS and Xcode.
Alright, so I was able to reproduce this error in my own project, so that's good. I don't think the problem is specific to iOS 7, but rather to their poor instructions for integration. But, I was able to get something working, so hopefully you can also. But, if you haven't yet really started, your best bet is probably cloning HelloWorld and putting your code in it. Moving on.
The version of the files they in the Frameworks directory appear to have a bug in it, and it's at a level that us developers can't fix. I'm filing an issue on GitHub (will update this later) for their info. Fix Number 1: Use the three files from the HelloWorld/Frameworks directory instead of the top-level frameworks directory.
That will get you building and running, but you'll get an error in your log because you're trying to use an external accessory without declaring permissions on it. So, head over to your Info.plist, and add a key: "Supported external accessory protocols", with item 0 being "com.orbotix.robotprotocol". Worth a thousand words:
From there, you just need to implement the rest of what they show in that sample. Easier said than done. I ended up making a handful of other changes to make my project look more like HelloWorld, but I'm not sure they're necessary. I've uploaded the initial, working state of my project to GitHub if you want to take a look / give it a try. It's here: SpheroSays on GitHub
Good luck!

Apple Mach-0 linker warning

I'm fairly new to ios programming. I've got an app that I think is almost ready for the appstore. However, I have one remaining warning and I'm not sure how to track down where the problem lies.
Here's the warning:
(null): Ignoring file /Users/maclehose/Library/Developer/Xcode/DerivedData/epidemiologyCalculator-esumevitgvkrmsfrmqeerqjyjfoh/Build/Products/Debug-iphoneos/epidemiologyCalculator.app/epidemiologyCalculator, missing required architecture arm64 in file /Users/maclehose/Library/Developer/Xcode/DerivedData/epidemiologyCalculator-esumevitgvkrmsfrmqeerqjyjfoh/Build/Products/Debug-iphoneos/epidemiologyCalculator.app/epidemiologyCalculator (2 slices)
Can anyone give me any specific advice on how to track down the source of the warning?
Thanks,
Rich
Go to targets and then Build Settings. Then turn the architectures to (armv7, armv7s). Like this you can silence the warning.
But then when you change it like this, it means that your app doesn't gets compiled for the 64-Bit architecture (iPhone 5S uses it).
You don't need 64-bit setting, if performance is not an issue. However if you really need it, you'll need to compile and build CorePlot library from source by adding it as a dependent project inside your app.

Compile Speex on xCode for iOS

I'm trying to compile and use the Speex codec for an iPhone app. I've used several tutorials:
http://codeforfun.wordpress.com/2010/04/29/compile-speex-for-iphone/
Also tried to compile it with this suggestion:
Cross -Compiling speex library for ios
and offcourse change the "SDKROOT" to "iphoneos"
all of this got me to a problem that I cannot really create binary files. I think I've tried everything!
I think the issue is something about makefile missing. I've changed the original Makefile.in to a "makefile" and now xCode can find it but still it doesn't work.
The error I get is : d: warning: directory not found for option '-L.../CSource/libspeex/.libs'
Undefined symbols for architecture armv7s:
"_speex_nb_mode", referenced from:
-[MainViewController viewDidLoad] in MainViewController.o
Please help!
I haven't tested it, but here is the Speex library precompiled for iOS: https://github.com/iosdevzone/IDZPrecompiledSpeex

Resources