iOS-底层原理 :objc4-787.1徒手 源码编译
1.下载objc4-787.1包
https://opensource.apple.com-> mac 10.15.5
2.设置Base SDK
Targets 中两个 objc和objc-trampolines都要设置,Build Setting ->Base SDK 选择MacOS 10.15
3.文件找不到设置
3.1 'sys/reason.h' file not found
macOS10.15 --> xnu-6153.11.26/bsd/sys/reason.h下载
3.2 'mach-o/dyld_priv.h' file not found
dyld-733.6 -- include -- mach-o -- dyld_priv.h
3.3 'os/lock_private.h' file not found. 'os/base_private.h' file not found
libplatform-220 --> private --> os --> lock_private.h 、base_private.h,并将
3.4 'pthread/tsd_private.h' file not found 'pthread/spinlock_private.h' file not found
libpthread-416.11.1 --> private --> tsd_private.h、spinlock_private.h
3.5'System/machine/cpu_capabilities.h' file not found
xnu6153.11.26 --> osfmk --> machine --> cpu_capabilities.h
3.6 'os/tsd.h' file not found
xnu6153.11.26 --> libsyscall --> os --> tsd.h
3.7 'System/pthread_machdep.h' file not found
Libc-583/pthreads/pthread_machdep.h
3.8'CrashReporterClient.h' file not found
Libc-825.24/include/CrashReporterClient.h
3.9'objc-shared-cache.h' file not found
dyld-733.6 --> include --> objc-shared-cache.h
3.10 '_simple.h' file not found
libplatform-220 --> private --> _simple.h
3.11'kern/restartable.h' file not found
xnu-6153.11.26 --> osfmk --> kern -->restartable.h
3.12'Block_private.h' file not found
libclosure-74 --> Block_private.h
3.13 can't open order file
选择 target -> objc -> Build Settings
在工程的 Order File 中添加搜索路径 $(SRCROOT)/libobjc.order
3.14not found for -lCrashReporterClient
进入TARGETS->objc->Build Settings->Linking->Other Linker Flags中删除lCrashReporterClient,DEBUG和RELEASE都删除。
demo