Is there a way to convert a library that is built for macOS to a library that I can use in my iOS project. I'm getting an error in my app that follows:
/Users/edwardpizzurro/Desktop/LibreriasAlternativas/LibreriasAlternativas.xcodeproj Building for iOS, but the linked library 'libsndfile.a' was built for macOS.
In general, it's not possible and you have to rebuild your library specifying iOS architecture.
To get more info about your library, run
lipo -info libsndfile.a
It'll give you architectures like armv7 armv7s i386 x86_64 arm64. A default architecture for iOS is arm64, while for MacOS it's x86_64 (we are not speaking of new M1 hardware). So most probably for your libsndfile.a you'll get only x86_64.
This will mean you need to build libsndfile by yourself.
Here are releases of this lib, there's no arm64 here: https://github.com/libsndfile/libsndfile/releases
So you have to donwload the repo: https://github.com/libsndfile/libsndfile
And use smth like Autotools to build it for your desired architecture.
A rough example of what you'll have to do it here: Can't cross compile C library for arm (iOS)
While it's quite specific for each library.
Related
I have a 3rd party static library that hasn't been updated in a long time. As such, it does not include an iPhone simulator build for M1 Macs.
% lipo -info ./Zebra/lib/libZSDK_API.a
Architectures in the fat file: ./Zebra/lib/libZSDK_API.a are: armv7 i386 x86_64 arm64
I tried to set the "Link Binary With Libraries" to be optional for this library so I can still run on the Simulator. (The library is just for printing, and I don't need to print from the Simulator.)
The problem is that even though I have marked the static library as optional, Xcode still gives me a linker error about the missing architecture.
error build: In ../XXXX/External/Zebra/lib/libZSDK_API.a(TcpPrinterConnection.o), building for iOS Simulator, but linking in object file built for iOS, file '../XXXX/External/Zebra/lib/libZSDK_API.a' for architecture arm64
Is there any way to get around this so that Xcode does not fail the build, but just leaves the library unlinked? I thought this was the whole point of the "optional" setting on Link Binary With Libraries?
I'm working with bluetooth in an old project which was written in swift3 and i'm working on converting it in swift4 and I had this error
"Could not find module 'CzsBleSdk' for architecture 'x86_64'; found: arm64, arm"
I seems that your framework was built and published the binary for the real device - armv7, armv7s, arm64 and you try to run a build for a simulator - x86_64.
Usually when a publisher wants to share a library he should create a Universal aka Fat binary using lipo[About] command.
If it is open source project you can import the project and Xcode will solve this issue
If it is closed source you can try to find it on Cocoapods or ask the publisher to upgrade the framework
You are now using 64 bit architecture in your Swift 4 project. You'll need the latest CzsBleSdk SDK which supports 64-bit architecture. You can integrate that manually or using Pod. I personally recommend Pod.
Has anyone successfully created and used a module that implements a 64 bit (only) static library?
Here the situation:
Created a new Appcelerator module project
Downloaded the latest HockeySDK-iOS framework (64 bit only)
Integrated HockeyApp HockeySDK-iOS into my module project
build iOS module project no problem
build (package) appcelerator module no problem (build.py)
create new appcelerator ios App project 5.2.2GA
install module (.zip) into App project
#ERROR Building the app project...
ld: symbol(s) not found for architecture x86_64
The HockeySDK appear to only be built for 64 bit support. I played around with the Architecture flags in my module project - but the Appcelerator app build seems to require the i386 x86_64 architecture.
Or has anyone implemented a current version of HockeyApp SDK for ios?
Please do not suggest: https://github.com/timanrebel/HockeyApp as that project uses HockeyApp iOS SDK v3.8.5 while the current HockeyApp SDK version for iOS is 4.0
As my understanding, "the Appcelerator app build seems to require the i386 x86_64 architecture." means your application now config of supporting both i386 and x86_64 architecture. i386 is the architecture of your desktop that will be required if you want to run on simulator. But your HockeySDK-iOS framework (64 bit only) will not suppose to support i386 architecture. As my guess, you got that missing i386 architecture error while running on simulator. Could you try to config your project support 64 bit only and then run the project on your real 64 bit devices.
In order to fix that error, you can remove your i386 architecture support or download again to make sure that all libraries have been built for i386 architecture.
i am new in ios development and now days working on an app that has been designed in 32 bit architecture with lots of 3rd party apis and cocopods usage in it.
As apple has decided to move all the apps to 64-bit architecture, i'm unable to figure out if there's any api in my code that's not following the rules and is still in 32bit architecture.
is there any way to check that and to convert them for 64bit architecture support.???
You can use lipo -info to get the supported architectures. For example:
lipo -info mylib.a
Could give an output like:
Architectures in the fat file: mylib.a are: armv7 i386 x86_64 arm64
In this case, you see arm64, which is the 64-bit slice you want.
As far as upgrading your libraries, you'll need to rebuild the libraries yourself or download new versions with 64-bit support.
I have a static library lipo'd for iOS and OS X with 5 architectures (x86_64, i386, armv7, armv7s, arm64).
The x86_64 architecture was built using the macosx SDK
The i386 architecture was built using the iphonesimulator SDK
The ARM architectures were built using the iphoneos SDK
When I try to link the resulting library in an example App it works when building for a device or for a 32-bit iOS simulator target. But when I try to build it for a 64-bit iOS simulator target I get a linker error:
ld: framework not found CoreServices for architecture x86_64
If I remove the x86_64 slice from the fat library it works for all devices and simulators.
I assume it's because the linker prefers the x86_64 architecture if it's there for the 64-bit simulator. But since it was compiled and linked for the macosx SDK it has the OS X dependencies somehow encoded.
I tried adding a second x68_64 slice for the iphonesimulator SDK but lipo won't let me. Also I tried to find a way to make the simulator use the i386 architecture even for 64-bit builds, but so far no luck.
If absolutely necessary I can create 2 binaries which would solve this but I would really prefer having them in one file. Is there a way to achieve this?
I solved it by only building it for the iOS device and simulator. The 64bit slice of the iOS Simulator SDK equally works for iOS and OS X targets, provided you don't need any other frameworks than what's shared between OS X and iOS (Foundation only in my case).
Project and Pods:
Build Settings ---> Link Frameworks Automatically change YES to NO, and rebuild static library ,it is work!