xcode 为什么我得到:对象文件是为更新的 iOS 版本构建的,而不是被链接的?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42070158/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why am I getting: Object file was built for newer iOS version than being linked?
提问by Warpzit
I'm getting "was built for newer version" warning when I build my project (see stack trace at bottom).
我在构建项目时收到“为较新版本构建”警告(请参阅底部的堆栈跟踪)。
I'm sure it is the right version as I'm building it myself and I've checked with otool (https://stackoverflow.com/a/32382761/969325).
我确定它是正确的版本,因为我正在自己构建它并且我已经使用 otool ( https://stackoverflow.com/a/32382761/969325)进行了检查。
The setup is a C++ library build with xcode command tool (libA.a) this library is then included into an xcode project which build a static library (libWordprediction). From there it is included into my main iOS project.
设置是使用 xcode 命令工具 (libA.a) 构建的 C++ 库,然后将该库包含到构建静态库 (libWordprediction) 的 xcode 项目中。从那里它包含在我的主要 iOS 项目中。
Every time we build a binary file we will lipo them together to a fat binary in order to build for both simulator and device.
每次我们构建一个二进制文件时,我们都会将它们一起打包成一个胖二进制文件,以便为模拟器和设备构建。
Now the setup works without any issues beside the warnings but I'd really like to be free of the warnings (and notjust with -w option!)
现在设置作品,未经警告旁边的任何问题,但我真的希望是免费的警告(并且不只是-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)
采纳答案by Warpzit
So my wrapper library used another library (boost) which were build for 10.2. This made my library build for higher version even though otool and xcode indicated something else and didn't give any errors when I build the library... Now I've stopped using the wrapper library (this is how I figured it out) and thereby cleaned up this mess as well.
所以我的包装库使用了另一个为 10.2 构建的库(boost)。这使我的库构建为更高版本,即使 otool 和 xcode 指示其他内容并且在构建库时没有给出任何错误......现在我已经停止使用包装库(这就是我想出来的)和从而也清理了这个烂摊子。
回答by shallowThought
You are building the libWordprediction
library for target OS 10.2
, but the app consuming the library targets OS 9
.
您正在libWordprediction
为目标操作系统构建库10.2
,但使用库的应用程序以操作系统为目标9
。
To fix this build libWordprediction
for target OS 9
too.
也libWordprediction
为目标操作系统修复此构建9
。