【发布时间】:2014-08-05 13:09:16
【问题描述】:
我想使用适用于 iOS 的 Pax86 库。最初我尝试手动创建库,因为我拥有所有必需的文件。但它由带有代码的文件组成,用于创建一个可以在终端上运行但仅适用于 iPhonesdk4.3 的静态库。由于我有 iPhonesdk7.1,我无法创建 Pax86 库。我没有带 iPhonesdk4.3 的系统。后来提供了基于 iPhoneSDK4.3 构建的静态库。
我将静态库 (.a) 文件添加到了新项目中,还将 pax86 的“包含”文件添加到了新应用程序中。 当我尝试调用任何与 pax86 相关的方法时,出现如下错误:
对于模拟器:
Ld /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphonesimulator/abc.app/abc normal i386
cd /Users/xyz/Documents/Sample_programs/abc
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Users/xyz/Documents/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Users/ramani/Documents/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Users/xyz/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Users/xyz/Documents/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphonesimulator -L/Users/xyz/Documents/Sample_programs/abc/abc -L/Users/xyz/Documents/Sample_programs/abc/abc -F/Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphonesimulator -filelist /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Intermediates/abc.build/Debug-iphonesimulator/abc.build/Objects-normal/i386/Shell.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework CoreLocation -framework CoreGraphics -lpax86 -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Intermediates/abc.build/Debug-iphonesimulator/Shell.build/Objects-normal/i386/abc_dependency_info.dat -o /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphonesimulator/abc.app/abc
ld: warning: ignoring file /Users/xyz/Documents/Sample_programs/abc/abc/libpax86.a, file was built for archive which is not the architecture being linked (i386): /Users/xyz/Documents/Sample_programs/abc/abc/libpax86.a
Undefined symbols for architecture i386:
"_retro_api_version", referenced from:
-[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
对于设备:
Ld /Users/xyz/Library/Developer/Xcode/DerivedData/Shell-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphoneos/abc.app/Shell normal armv7
cd /Users/ramani/Documents/Sample_programs/Shell
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Users/xyz/Documents/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Users/ramani/Documents/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Users/xyz/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Users/xyz/Documents/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -L/Users/ramani/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphoneos -L/Users/xyz/Documents/Sample_programs/abc/abc -L/Users/xyz/Documents/Sample_programs/abc/abc -F/Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphoneos -filelist /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Intermediates/abc.build/Debug-iphoneos/Shell.build/Objects-normal/armv7/Shell.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.1 -framework CoreLocation -framework CoreGraphics -lpax86 -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Intermediates/abc.build/Debug-iphoneos/Shell.build/Objects-normal/armv7/abc_dependency_info.dat -o /Users/xyz/Library/Developer/Xcode/DerivedData/abc-dvbzzlhzahggryayfurclxrbdjio/Build/Products/Debug-iphoneos/abc.app/abc
ld: archive has no table of contents file '/Users/xyz/Documents/Sample_programs/abc/abc/libpax86.a' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已将“构建活动架构”设置为“是”和“否”,删除了所有其他架构,如 armv7s、arm64 等,但仍然出现上述问题。
我什至已将 .a 文件添加到 usr/lib,然后将其添加到构建设置中。清除了库搜索路径和框架搜索路径。
我导入了所附屏幕截图中的静态库,即使没有“包含”也尝试过。
您能帮我解决这个问题吗?是不是因为静态库仅适用于 iPhoneSDK4.3 而不是 iPhoneSDK7.1 或任何其他 SDK。我也在 iPhoneSDK3.2 中尝试过,但没有运气。
请帮忙。
提前致谢。
【问题讨论】:
-
您需要在命令行中使用
lipo -info检查库中包含的架构。 -
包含的架构是armv7。在带有静态库的新应用程序中,我已将“架构”更改为 armv7,将“有效架构”更改为 armv7。但同样的错误发生了。我有 Xcode 5.1.1 和 OS X 10.8.5 。我已经在 iPad2 上用 iOS 7.1 测试过它。 @Droppy
-
好的,我错过了错误消息“存档没有目录文件”,因此看起来静态库已损坏。您可以尝试使用
ar提取目标文件并尝试重新添加它们,但我从未使用 fat binaries 这样做。
标签: ios objective-c iphone static-libraries iphone-sdk-4.3