Compiling XZ Utils for iOS

2019-06-08 18:42发布

问题:

I am trying to compile XZ Utils for iOS.

How I am running ./configure:

CC="clang -arch armv7 -arch armv7s -arch arm64 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk" \
./configure --disable-dependency-tracking \
--host=arm-apple-darwin15.0.0 --build=x86_64-apple-darwin15.3.0

It compiles fine if I only specify one architecture.

configure:6216: clang -arch armv7 -arch armv7s -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -E  conftest.c
clang: error: cannot use 'cpp-output' output with multiple -arch options

I want fat binaies containing armv7, armv7s, and arm64 slices to be compiled. Is there any way to get around this limitation of clang?

回答1:

You can only use one architecture as a target, you have to use lipo to create the fat library.

As an example:

lipo -create -output fat.a thin1.a thin2.a