Lipo in not creating for arm64, armv7 - ios

I'm using the LAME MP3 encoder to convert the caf formatted file to MP3 format. I downloaded LAME and compile and build all architecture like arm64, armv7, armv7s, armv6, i386, i686, x86_64 successfully. I followed this link to create the libraries.
But I'm trying to create lipo for armv7, arm64, x86_64 which support to my project. But I'm getting fatal error.
Here is the error that I'm getting.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: build/libmp3lame-arm64.a and build/libmp3lame-armv7.a have the same architectures (x86_64) and can't be in the same fat output file.
I tried the all combination which two architectures can create fat file, except single only creating. I need it for ios 8.1 and above (please mention which architectures should I put in the fat file for iPhone 4s and above)

It looks like something went wrong with your build: libmp3lame-arm64.a, libmp3lame-armv7.a should have been device builds but they seem to have come out as simulator builds.
You can confirm this by running file on them:
file build/libmp3lame-arm64.a build/libmp3lame-armv7.a
I don't know why it happened, nor which of many answers you used in the question you linked to.
Can you give more information on how you configured and built lame?

Related

Optional library with missing simulator architecture

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?

Why does Xcode build for arm64 even when excluded?

I am trying to solve a problem related to Xcode 12, building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
As an experiment, I wanted to see if I could configure one of my frameworks to only build x86_64 for all cases.
Here is my config:
You can see I have overridden the architectures to be x86_64 and I am excluding arm64. I am also only building active architectures only. There is no way that arm64 should ever be considered during a build.
And yet...
Here is the output of a build the very next moment. It's tons of source files that indicate they are still being compiled for arm64.
Can anyone explain this discrepancy? I am running the latest Xcode, 13.2.1, on a new M1 Max laptop.

Convert library.a for macOSX to library.a for iOS

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.

Shell script for remove the unneeded architectures while archiving not working

I have tried to use the shell scripts of #Varrry and #pAkY88 on the question Submit to App Store issues: Unsupported Architecture x86 but they are not working while archiving,the unneeded architectures are not removed, so when I'm trying to upload to the Store I get the error: "Unsupported Architecture. Your executable contains unsupported architecture '[x86_64, i386]'."
The project (Swift) has arm64 armv7 and armv7s as valid architectures, the project is using a framework made by myself(in Swift), and some firebase frameworks(Objective-C), all this frameworks have the simulator slice because I'm using a continues integration and all the tests runs on the simulator.
The log from the script is here

IOS native plugin for universal architecture

I have a project in Unity3d that uses an iOS native plugin that I made in Xcode.
I use Unity3d v4.6.2 with Scripting Backend option in IL2CPP and Architecture option in "Universal"
Whem I run the project on my ipod5, it works but when I want to archive it, I have errors links with my library:
Undefined symbols for architecture arm64
with a warning that says
file was built for archive which is not the architecture being linked (arm64)
My library configuration is the following
http://imgur.com/AvbBYFo
and my list of iOS simulators is
http://imgur.com/XlSojzT
I try them all and none works
When I run the command
lipo -info mylib.a
I see the following information
input file mylib.a is not a fat file
Non-fat file: mylib.a is architecture: x86_64
I need my project to all the architecture, but do not know what else to configure.
Thanks for your help

Resources