我需要创建一个Cocoa Touch Static库项目的通用库,
我正在使用
xcodebuild -target mysdsk ONLY_ACTIVE_ARCH=NO VALID_ARCHS="arm64 armv7 armv7s i386 x86_64" -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
即使我将iphonesimulator拆分为两个xcodebuild仍然无法获得i386 for iphone4 simuator
我收到错误
Undefined symbols for architecture i386
基于How do I determine the target architecture of static library (.a) on Mac OS X?
我尝试运行file命令,显示
mysdsk.a: Mach-O universal binary with 5 architectures
mysdsk.a (for architecture i386): current ar archive random library
mysdsk.a (for architecture armv7): current ar archive random library
mysdsk.a (for architecture armv7s): current ar archive random library
mysdsk.a (for architecture x86_64): current ar archive random library
mysdsk.a (for architecture arm64): current ar archive random library
但我仍然收到错误
Undefined symbols for architecture i386
答案 0 :(得分:1)
无论你采用什么方法,从架构列表中我认为一切都很好。
XCode存在一个问题,即使您拖放 mysdsk.a 或在链接器设置内部进行更改,XCode仍然可以选择存储在
内的错误文件/Users/<your username>/Library/Developer/Xcode/DerivedData/mysdsk_........ folder
您可以从XCode警告中识别出3个切片,但实际上是5个切片
ld:警告:忽略文件/Users//Library/Developer/Xcode/DerivedData/mysdsk_......./..../mysdsk.a,缺少文件/用户//库中所需的架构i386 /Developer/Xcode/DerivedData/mysdsk_......./..../mysdsk.a(3个切片)
因此删除文件夹/ Users // Library / Developer / Xcode / DerivedData / mysdsk _ms
然后它应该工作正常,实际上我发现这个问题,其他机器工作正常,但我的机器不工作。
参考ignoring file [path] missing required architecture i386 in file