我为什么得到:对象文件是为较新的iOS版本而不是链接而构建的?

时间:2017-02-06 14:28:48

标签: ios xcode

当我构建项目时,我正在“为更新的版本构建”警告(请参阅底部的堆栈跟踪)。

我确定它是正确的版本,因为我自己构建它并且我已经使用otool(https://stackoverflow.com/a/32382761/969325)进行了检查。

该设置是使用xcode命令工具(libA.a)构建的C ++库,然后将该库包含在构建静态库(libWordprediction)的xcode项目中。从那里它被包含在我的主要iOS项目中。

每次我们构建二进制文件时,我们都会将它们组合成一个胖二进制文件,以便为模拟器和设备构建。

现在设置在警告旁边没有任何问题,但我真的想摆脱警告(并且只使用-w选项!)

Showing All Messages
Ld /Users/me/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Intermediates/myproject.build/Debug-iphoneos/myproject-da.build/Objects-normal/armv7/myproject-da normal armv7
    cd /X/git/myproject-iOS
    export IPHONEOS_DEPLOYMENT_TARGET=9.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -L/Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Products/Debug-iphoneos -L/X/git/myproject-iOS/myproject/Resources/ReaderResources/Libraries -L/X/git/myproject-iOS/myproject/Resources/ReaderResources -L/x/Libraries -L/X/git/myproject-iOS/myproject/Module/OCRMODULE/MobileOCR/lib/combined -F/Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Products/Debug-iphoneos -F/X/git/myproject-iOS -F/X/git/myproject-iOS/Build -filelist /Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Intermediates/myproject.build/Debug-iphoneos/myproject-da.build/Objects-normal/armv7/myproject-da.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Intermediates/myproject.build/Debug-iphoneos/myproject-da.build/Objects-normal/armv7/myproject-da_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Intermediates/myproject.build/Debug-iphoneos/myproject-da.build/Objects-normal/armv7/myproject_da.swiftmodule -lxml2 -lstdc++ -lcrypto -lssl -lxml2 -lstdc++ -lcrypto -lssl -ObjC -lWordprediction -framework MVInAppPurchase -lMVSpeechSynthesizer -lAbbyyMsdk /Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Products/Debug-iphoneos/Alamofire.framework/Alamofire -framework Crashlytics -lxml2 -lsqlite3 -lz -lc++ -framework myprojectKeyboardTestable -framework SystemConfiguration -framework PSPDFKit -framework JavaScriptCore -framework OpenGLES -framework MobileCoreServices -framework myprojectAppleSpeechFramework -framework UIKit -framework GLKit -framework Accelerate -framework CoreTelephony -framework CFNetwork -framework CoreMedia -framework MVIDDeviceConnectorFramework -lcrypto -framework AVFoundation -framework Fabric -framework AudioToolbox -framework StoreKit -framework Security -framework UtilFramework -framework AssetsLibrary -framework CoreImage -framework ProfileFramework -lssl -framework CoreText -framework CoreData -framework CoreGraphics -framework Foundation -framework Social -framework ImageIO -framework MediaPlayer -framework myprojectServicesFramework -framework MessageUI -framework QuartzCore -framework QuickLook -framework GSS -Xlinker -dependency_info -Xlinker /Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Intermediates/myproject.build/Debug-iphoneos/myproject-da.build/Objects-normal/armv7/myproject-da_dependency_info.dat -o /Users/eg/Library/Developer/Xcode/DerivedData/myproject-ftdgvukparnrnsaefbeurzbnoxrp/Build/Intermediates/myproject.build/Debug-iphoneos/myproject-da.build/Objects-normal/armv7/myproject-da

ld: warning: directory not found for option '-F/X/git/myproject-iOS/Build'
ld: warning: object file (/x/Libraries/libWordprediction.a(c_regex_traits.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(chrono.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(codecvt_error_category.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(connection.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(cpp_regex_traits.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(cregex.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(date_generators.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(error_code.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(fileiter.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(future.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(graphml.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(greg_month.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(greg_weekday.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(icu.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(instances.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(named_slot_map.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(once.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(operations.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(path.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(path_traits.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(portability.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(posix_api.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(process_cpu_clocks.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(random_device.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(read_graphviz_new.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(regex.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(regex_debug.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(regex_raw_buffer.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(regex_traits_defaults.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(signal_base.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(slot.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(static_mutex.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(thread.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(thread_clock.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(trackable.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(unique_path.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(usinstances.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(utf8_codecvt_facet.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(w32_regex_traits.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(wc_regex_traits.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(wide_posix_api.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(windows_file_codecvt.o)) was built for newer iOS version (10.2) than being linked (9.0)
ld: warning: object file (/x/Libraries/libWordprediction.a(winstances.o)) was built for newer iOS version (10.2) than being linked (9.0)

2 个答案:

答案 0 :(得分:2)

您正在为目标操作系统libWordprediction构建10.2库,但使用该库的应用程序将以操作系统9为目标。

为目标操作系统libWordprediction修复此版本9

答案 1 :(得分:2)

所以我的包装器库使用另一个为10.2构建的库(boost)。这使我的库构建为更高版本,即使otool和xcode表示其他内容并且在构建库时没有给出任何错误...现在我已经停止使用包装器库(这就是我的想法它出来了,从而清理了这个烂摊子。