我已经为这个'小'问题工作了几个小时。我试图创建一个通用库,我设法得到3套架构,当我用lipo -info检查我的通用库
armv7 i386 arm64
并使用文件命令
Mach-O universal binary with 3 architectures
(for architecture armv7): current ar archive random library
(for architecture i386): current ar archive random library
(for architecture arm64): current ar archive random library
我的shell脚本创建通用lib;
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# Step 1. Build Device and Simulator versions
xcodebuild -target libTest ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
xcodebuild -target libTest ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"
# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}/"
我的构建设置;
build active architecture only - NO
Architectures;
$(ARCHS_STANDARD)
x86_64 (i added this)
Valid architectures;
armv7s
x86_64
armv7
arm64
i386
我尝试了一切,但似乎仍然失败。如何创建一个包含所有这些架构的胖文件?