美文网首页
iOS_objc4-886.9最新源码编译调试

iOS_objc4-886.9最新源码编译调试

作者: YY323 | 来源:发表于2023-01-12 16:55 被阅读0次

https://opensource.apple.com/releases/中下载objc4最新版源码,解压编译

错误1:unable to find sdk 'macosx.internal'

  • 解决方案:将TARGETSobjcobjc-simulatorobjc-trampolinesBuild Settings-->Base SDK改为macOS
objc
objc-simulator objc-trampolines
错误2:'sys/reason.h' file not found
  • 解决方案:
    第一步:下载reason.h文件

      1. 通过[Apple source](https://opensource.apple.com/releases/)在最新版xnu-8792.41.9/bsd/sys/reason.h路径下载
      2. 通过谷歌输入`reason.h site:opensource.apple.com` 定向检索
    

    第二步:把文件放入到工程中:在objc4工程根目录创建新文件夹Common/sys,将reason.h文件放入文件夹中

    第三步: 在工程设置文件的检索路径

    • 选择target->objc->Build Settings
    • Header Search Paths-->$(SRCROOT)/Common

其他file not found错误解决方案同上

  1. mach-o/dyld_priv.h:在objc4工程根目录创建新文件夹Common/mach-o,将dyld_priv.h文件放入文件夹中
    mach-o/dyld_priv.h

dyld_priv.h中报错Expected ',':删掉文件中的所有, bridgeos(~.0)

  1. os/lock_private.h :将base_private.h文件放入Common/os文件夹中
    os/lock_private.h 文件中报错Expected ',':删掉, bridgeos(4.0)
  2. os/base_private.h:将base_private.h文件放入Common/os文件夹中


    base_private.h
  3. pthread/tsd_private.h:在objc4工程根目录创建新文件夹Common/pthread,将tsd_private.h文件放入文件夹中
    tsd_private.h
  4. machine/cpu_capabilities.h:把错误处改成#include <System/machine/cpu_capabilities.h>,在objc4工程根目录创建新文件夹Common/System/machine,将cpu_capabilities.h文件放入文件夹中
    cpu_capabilities.h
  5. os/feature_private.h:直接注释


    直接注释报错引用
  6. os/tsd.h:将tsd.h文件放入Common/os文件夹中


  7. os/variant_private.h
  8. System/pthread_machdep.h
    https://opensource.apple.com/source/Libc/Libc-583/pthreads/下载pthread_machdep.h文件,在objc4工程根目录创建新文件夹Common/System,将pthread_machdep.h文件放入文件夹中
  • 文件报错:Static declaration of 'pthread_has_direct_tsd’ follows non-static declaration、
    _Static declaration of ‘_pthread_getspecific_direct’ follows non-static declaration、
    Static declaration of ‘_pthread_setspecific_direct’ follows non-static declaration

  • 解决方案:注释掉报错的方法

    1. variant_private.h文件报错:删掉, bridgeos(4.0)
  1. System/machine/cpu_capabilities.h
  2. CrashReporterClient.h
    https://opensource.apple.com/source/Libc/Libc-997.90.3/include/CrashReporterClient.h.auto.html处下载,放在/Common文件夹下
    依然报错:在 Build Settings -> Preprocessor Macros 中加入: LIBC_NO_LIBCRASHREPORTERCLIENT
#include_next<CrashReporterClient.h>改为
#include <CrashReporterClient.h>
Other Linker Flags中移除CrashReporterClient
  1. Block_private.h
  2. objc-shared-cache.h
  3. os/linker_set.h
  4. Use of undeclared identifier 'dyld_platform_version_macOS_10_13':直接注释报错代码

  5. _simple.h
  6. sandbox/private.h
    注释掉,编译后出错,出错的代码也注释掉,再添加一行

      _simple_asl_log(ASL_LEVEL_ERR, nil, message);
    
  1. os/bsd.h和Cambria/Traps.h和Cambria/Cambria.h:注释
  2. kern/restartable.h
  3. os/reason_private.h
  4. Use of undeclared identifier 'dyld_platform_version_macOS_10_12'直接注释
  5. "macosx.internal" cannot be located.

    其他file not found错误 和 Use of undeclared identifier错误 都注释掉代码即可

  6. library not found for -loah:在objc->Build Settings->Other Linker Flags中删除-loah

编译成功!

TODO

调试时报错:This version of LLDB has no plugin for the language "assembler". Inspection

相关文章

网友评论

      本文标题:iOS_objc4-886.9最新源码编译调试

      本文链接:https://www.haomeiwen.com/subject/icddxdtx.html