网络知识 娱乐 objc4-841.13可调试/编译源码更新

objc4-841.13可调试/编译源码更新

心心念念查看了下objc4源码 https://opensource.apple.com/releases/ ,果然更新了,果断编译调试

如果想最省时省力,直接 github 下载可编译源码

下面开始配置可编译环境(本次配置为M1)

首先确保下载到841.13源码

首先编译target objc

  1. unable to find sdk ‘macosx.internal’

在这里插入图片描述

  • PROJECTS –> objc –> Build Settings, 将 Base SDK 改成 macOS
  • TARGETS –> objc –> Build Settings, 将 Base SDK 改成 macOS
  1. ‘sys/reson.h’ file not found
  • 下载xnu-8020.101.4, 把 xnu-8020.101.4/bsd/sys/reason.h 文件复制到 comm_ifl/sys 目录下

在这里插入图片描述

在这里插入图片描述

  • 设置头文件搜索路径:TARGETS –> objc –> Build Settings –> Header Search Paths, 添加一条 $(SRCROOT)/comm_ifl

在这里插入图片描述

  1. ‘mach-o/dyld_priv.h’ file not found

在这里插入图片描述

  • 下载 dyld-955, 把 dyld-955/include/mach-o/dyld_priv.h 拷贝到 comm_ifl/mach-o/dyld_priv.h

在这里插入图片描述

  1. ‘os/lock_private.h’ file not found

在这里插入图片描述

  • 下载 libplatform-273.100.5, 把 libplatform-273.100.5/private/os/lock_private.h 拷贝到 comm_ifl/os/lock_private.h

在这里插入图片描述

  1. extern dyld_platform_t dyld_get_active_platform(void) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0)); ---- 报错 Expected ‘,’

在这里插入图片描述

  • 由于调试主要基于macos,删除, bridgeos(3.0)
  1. 批量同5

在这里插入图片描述

  • 同样均删除掉 , bridgeos(3.0)
  1. ‘os/base_private.h’ file not found

在这里插入图片描述

  • 下载源码(macOS Catalina 10.15 - macOS 10.15.6)libplatform-220.100.1, 把 libplatform-220.100.1/private/os/base_private 拷贝到 comm_ifl/os/base_private.h

在这里插入图片描述

  1. ‘pthread/tsd_private.h’ file not found
  • 下载 libpthread-libpthread-486.100.11 libpthread-libpthread-486.100.11/private/pthread/tsd_private.h 拷贝到 comm_ifl/pthread/tsd_private.h
  1. ‘System/machine/cpu_capabilities.h’ file not found
  • xnu-xnu-8020.101.4/osfmk/machine/cpu_capabilities.h 拷贝到 comm_ifl/System/machine/cpu_capabilities.h
  1. ‘os/feature_private.h’ file not found
  • 注释掉
  1. ‘os/variant_private.h’ file not found
  • google搜索 os/variant_private.h opensource.apple.com

    得到结果 https://opensource.apple.com/source/Libc/Libc-1244.50.9/os/variant_private.h.auto.html 根据路径找文件

  • 拷贝 Libc-Libc-1507.100.9/os/variant_private.hcomm_ifl/os/variant_private.h

  1. ‘os/tsd.h’ file not found
  • 拷贝 xnu-xnu-8020.101.4/libsyscall/os/tsd.hcomm_ifl/os/tsd.h
  1. ‘pthread/spinlock_private.h’ file not found
  • 拷贝 libpthread-libpthread-486.100.11/private/pthread/spinlock_private.hcomm_ifl/pthread/spinlock_private.h
  1. ‘System/pthread_machdep.h’ file not found
  • 拷贝 Libc-825.24/pthreads/pthread_machdep.hcomm_ifl/System/pthread_machdep.h
  1. bridgeos(4.0) 问题
  • 去除

在这里插入图片描述

  1. ‘CrashReporterClient.h’ file not found
  • 拷贝 Libc-825.24/include/CrashReporterClient.hcomm_ifl/CrashReporterClient.h
  1. Typedef redefinition with different types (‘int’ vs ‘volatile OSSpinLock’ (aka ‘volatile int’))

在这里插入图片描述

  • 注释掉

在这里插入图片描述
在这里插入图片描述

  1. Use of undeclared identifier ‘dyld_platform_version_macOS_10_13’

在这里插入图片描述

  • 注释

在这里插入图片描述

  1. ‘os/bsd.h’ file not found
  • 注释
  1. ‘os/reason_private.h’ file not found
  • 拷贝 xnu-xnu-8020.101.4/libkern/os/reason_private.hcomm_ifl/os/reason_private.h
  1. ‘objc-shared-cache.h’ file not found
  • 拷贝 dyld-dyld-955/include/objc-shared-cache.hcomm_ifl/objc-shared-cache.h
  1. ‘os/linker_set.h’ file not found
  • 拷贝 Libc-Libc-1507.100.9/os/linker_set.hcomm_ifl/os/linker_set.h
  1. ‘_simple.h’ file not found
  • 拷贝 Libc-825.24/gen/_simple.hcomm_ifl/_simple.h
  1. dyld_program_sdk_at_least(dyld_fall_2020_os_versions)

在这里插入图片描述

  • 注释掉

在这里插入图片描述

  1. Use of undeclared identifier ‘objc4’
  • 注释掉
  1. Use of undeclared identifier ‘CRGetCrashLogMessage’

在这里插入图片描述
在这里插入图片描述

  1. ‘Cambria/Traps.h Cambria/Cambria.h’ file not found
  • 注释
  1. ‘kern/restartable.h’ file not found
  • xnu-xnu-8020.101.4/osfmk/kern/restartable.h 拷贝到 comm_ifl/kern/restartable.h
  1. Use of undeclared identifier ‘oah_is_current_process_translated’

在这里插入图片描述
在这里插入图片描述

  1. Block_private.h
  • libclosure-libclosure-79.1/Block_private.h 拷贝到 comm_ifl/Block_private.h
  1. Use of undeclared identifier ‘os_parse_boot_arg_string’
  • 注释掉

在这里插入图片描述

  1. Use of undeclared identifier ‘dyld_platform_version_macOS_10_11’

在这里插入图片描述
在这里插入图片描述

  1. Use of undeclared identifier ‘dyld_fall_2018_os_versions’
  • 注释掉

在这里插入图片描述

  1. Use of undeclared identifier ‘dyld_platform_version_macOS_10_12’

在这里插入图片描述
在这里插入图片描述

  1. ‘_static_assert’ declared as an array with a negative size

在这里插入图片描述

  • 注释

dyld_priv.h 文件顶部加入宏

#define DYLD_MACOSX_VERSION_10_11 0x000A0B00
#define DYLD_MACOSX_VERSION_10_12 0x000A0C00
#define DYLD_MACOSX_VERSION_10_13 0x000A0D00
#define DYLD_MACOSX_VERSION_10_14 0x000A0E00

CrashReporterClient异常

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

ld -loah报错

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

objc编译成功

在这里插入图片描述

接下来objc进行编译调试

  • 新建target

在这里插入图片描述

  • 建立依赖

在这里插入图片描述
在这里插入图片描述

编译调试target

在这里插入图片描述

  • 下符号 alloc调试

在这里插入图片描述

进入源码 alloc

坚持到这一步,M1 objc调试环境OK,就恭喜了