在过去的几天里,我一直在处理一个无法解决的问题。我正在尝试建立一个旧的(6年!)iOS游戏项目,并且链接器失败,并出现以下错误:
Absolute addressing not allowed in arm64 code but used in '-[Snip snap]' referencing '_NSFileModificationDate' for architecture arm64
所引用的类的确以NSDictionary
作为参数调用-objectForKey:
NSFileModificationDate
。这是一个Objective-C ++源文件,因为它确实包含C ++代码。
据我所知,链接器认为我将源代码编译为与位置相关且失败,如arm64所预期的那样。但是为什么呢?
到目前为止我已经尝试或检查的内容:
NO
-all_load
-ObjC
NO
clean
并删除DerivedData
文件夹,然后进行任何更改后再重建asm
代码的所有源文件.m
或.mm
源文件,就像NSFileModificationDate
一样,将无法链接 otool -hv
给出:
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 ARM64 ALL 0x00 OBJECT 4 3000 SUBSECTIONS_VIA_SYMBOLS
这是错误文件的编译命令(对不起,这很冗长):
CompileC SNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/Objects-normal/arm64/Snip.o SNIPDesktop/SNIP/SNIP/Classes/App/Snip.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target: SNIP)
cd SNIPDesktop/SNIP/SNIP
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu++14 -stdlib=libc++ -fmodules -gmodules -fmodules-cache-path=SNIPLibrary/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=SNIPLibrary/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -miphoneos-version-min=12.0 -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -fembed-bitcode-marker -index-store-path SNIP/Index/DataStore -iquote SNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/SNIP-generated-files.hmap -ISNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/SNIP-own-target-headers.hmap -ISNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/SNIP-all-target-headers.hmap -iquote SNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/SNIP-project-headers.hmap -ISNIP/Build/Products/Debug-iphoneos/include -ISNIPDesktop/SNIP/SNIP/External -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/libxml2 -ISNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/DerivedSources/arm64 -ISNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/DerivedSources -FSNIP/Build/Products/Debug-iphoneos -include SNIP/Build/Intermediates.noindex/PrecompiledHeaders/SharedPrecompiledHeaders/12134743132148408221/SNIP_prefix.pch -MMD -MT dependencies -MF SNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/Objects-normal/arm64/Snip.d --serialize-diagnostics SNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/Objects-normal/arm64/Snip.dia -c SNIPDesktop/SNIP/SNIP/Classes/App/Snip.mm -o SNIP/Build/Intermediates.noindex/SNIP.build/Debug-iphoneos/SNIP.build/Objects-normal/arm64/Snip.o
我想念什么?我还应该寻找什么线索?我应该检查任何警告消息吗?
感谢您的帮助!