编译objc4-818.2源码
从APP Source下载源码。下载完之后打开项目编译objc,
-
unable to find sdk 'macosx.internal'错误 在Build Settings->Base SDK选择macOS -
'sys/reason.h' file not found错误是文件找不到大家可以通过 Apple source 在 xnu-4903.241.1/bsd/sys/reason.h 路径自行下载,把找到的文件加入到工程里面。然后选择
target->objc->Build Settings在工程的Header Serach Paths中添加搜索路径$(SRCROOT)/JCCommon文件补漏情况
-
'CrashReporterClient.h' file not found 需要在
Build Settings->Preprocessor Macros中加入:LIBC_NO_LIBCRASHREPORTERCLIENT -
'os/feature_private.h' file not found注释掉部分报错代码 -
'objc-bp-assist.h' file not found注释掉头文件 -
'Cambria/Cambria.h' file not found注释头文件 -
'_static_assert' declared as an array with a negative size注释这行代码 -
can't open order file: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/AppleInternal/OrderFiles/libobjc.order选择target->objc->Build Settings在工程的
Order File中添加搜索路径$(SRCROOT)/libobjc.order -
library not found for -lCrashReporterClient选择target->objc->Build Settings在Other Linker Flags中删除-lCrashReporterClient(Debug和Release都删了) -
ld: library not found for -loah选择target->objc->Build Settings在Other Linker Flags中删除-loah(Debug和Release都删了) -
/objc4-818.2/xcodebuild:1:1: SDK "macosx.internal" cannot be located.选择target->objc->Build Phases->Run Script(markgc)把脚本文本macosx.internal改成macosx
编译成功之后
编译调试
- 新建一个
TargetJCObject
- 绑定二进制依赖关系
- 运行代码进入源码,大家可以自由编译调试咯!