为什么我收到:对象文件是为比链接更新的 iOS 版本构建的?

War*_*zit 5 xcode ios

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

我确信这是正确的版本,因为我正在自己构建它,并且我已经使用 otool (/sf/answers/2266793301/)进行了检查。

该设置是使用 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)
Run Code Online (Sandbox Code Playgroud)

War*_*zit 2

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