iOS_objc4-886.9最新源码编译调试

2023-01-12  本文已影响0人  YY323

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

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

objc
objc-simulator objc-trampolines
错误2:'sys/reason.h' file not found

其他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文件放入文件夹中
  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

上一篇下一篇

猜你喜欢

热点阅读