I am trying to create a single .a file which will contain 3 different .a files so that I could share only one .a file. This is the command I am using
lipo -create -output ./libOutput.a ./libInput1.lib ./libInput2.lib ./libInput3.lib
but I am getting this lipo error:
./libInput1.lib and ./libInput2.lib have the same architectures (i386) and can't be in the same fat output file
Any idea how to get rid of this?
So this is the second time I have been here. The answer did not fix my problem. What I have found is that this is actually a bug in Xcode. What has happened both times is that I come and find this answer and that is not my problem and then I'm messing around for hours trying to figure out what's going on and the next thing I know Xcode crashes. Open up Xcode again and magic the problem is gone.
So I am adding my answer to help me remember this next time.
A workaround that worked for me (because I couldn't figure out what part of the building process was creating an additional architecture target to the compilation):just remove the architecture from one of the two .a libraries.
First, you can list the architecture with a simple file command:
$ file libwhatever.a
libwhatever.a: Mach-O universal binary with 4 architectures
libwhatever.a (for architecture armv7): current ar archive random library
libwhatever.a (for architecture armv7s): current ar archive random library
libwhatever.a (for architecture arm64): current ar archive random library
libwhatever.a (for architecture i386): current ar archive random library
$ file libfoo.a
libfoo.a: Mach-O universal binary with 2 architectures
libfoo.a (for architecture i386): current ar archive random library
libfoo.a (for architecture x86_64): current ar archive random library
Then, this workaround is just about removing the i386 arch from the first libwhatever.a (which was supposed to be just for arm* arch in my case anyway).
lipo -remove i386 libwhatever.a -output /tmp/libwhatever.a
mv /tmp/libwhatever.a libwhatever.a
and then you can create/merge your .a files without any warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With