• build objc4 runtime


    build objc4 runtime

     1、Get the latest objc4 project codes from www.opensource.apple.com.

     2、Open the projetct, compile it, you will get compile error.

     3、you need some file to complete the compilation.

      1) Create Directory: /tmp/objc.dst/usr/include

      2) from libauto project, get auto_zone.h. Put it in the directory we just created.

      3) from libclosure project, get Block_private.h. Put it in the directory we just created.

      4) from libc project, get CrashReporterClient.h. Put it in the directory we just created.

          from libc project, get pthreads/pthread_machdep.h. Put it in the directory we just created with dirname of "system".

      5) from libdispatch project, get private-dir codes. Put it in the directory we just created with dirname of "dispatch".

      6) from dyld project, get dyld_priv.h. Put it in the directory we just created with dirname of "mach-o".

          from dyld project, get objc-shared-cache.h. Put it in the directory we just created.

      7) from xnu project, get osfmk/machine/cpu_capabilities.h. Put it in the directory we just created with dirname of "system/machine".

      8) from lanuchd project, get vproc_priv. Put it in the directory we just created.

      After did all these stuff, you'll get a structure as follow:

      

     4、In step3, you find alll the header files that you need. Compile the objc project, you still get error. You need do following 3 things:

      1) add LIBC_NO_LIBCRASHREPORTERCLIENT macro into you configuration.

      

      2) add #define CRSetCrashLogMessage2(x) /* nothing */ into CrashReporterClient.h. As follow:

      

      3) remove the link to the CrashReporterClient.

     5、Compile objc project, this time you'll success. There're some warning, you can ignore it. 

      

      

     6、for convenience,I wrote the code below to help get all the headers.

    View Code
     1 # $1=src & $2=dst
     2 DST_PATH="./headers/"
     3 function findAndCopyTo
     4 {
     5     src_path=`find ./.. -path $1`
     6     if [ -z $src_path ] 2>&-
     7         then 
     8         echo "error, cannot find $1"
     9         exit 0
    10     fi
    11 
    12     echo "has find $src_path"
    13 
    14     dst_path=${DST_PATH}${2}
    15     #echo $dst_path
    16 
    17     if [ ! -x $dst_path ]
    18         then 
    19         mkdir $dst_path
    20     fi
    21 
    22     cp $src_path $dst_path 2>&-
    23 }
    24 
    25 rm -rf $DST_PATH
    26 mkdir $DST_PATH
    27 
    28 #root
    29 findAndCopyTo "*/auto_zone.h" "./"
    30 findAndCopyTo "*/Block_private.h" "./"
    31 findAndCopyTo "*/CrashReporterClient.h" "./"
    32 findAndCopyTo "*/objc-shared-cache.h" "./"
    33 findAndCopyTo "*/vproc_priv.h" "./"
    34 
    35 #dispatch
    36 findAndCopyTo "*libdispatch*/benchmark.h" "./dispatch/"
    37 findAndCopyTo "*libdispatch*/data_private.h" "./dispatch"
    38 findAndCopyTo "*libdispatch*/private.h" "./dispatch"
    39 findAndCopyTo "*libdispatch*/queue_private.h" "./dispatch"
    40 findAndCopyTo "*libdispatch*/source_private.h" "./dispatch"
    41 
    42 #mach-o
    43 findAndCopyTo "*dyld*/dyld_priv.h" "./mach-o"
    44 
    45 #system
    46 findAndCopyTo "*Libc*/pthread_machdep.h" "./system"
    47 
    48 #system/machine
    49 findAndCopyTo "*xnu*machine/cpu_capabilities.h" "./system/machine"
  • 相关阅读:
    SQL Server 2k5数据挖掘功能介绍
    SQL 链接字符串
    【javascript】收藏本站——添加到浏览器收藏夹
    【转】web 前端研发工程师编程能力飞升之路
    【javascript】cookie 的应用——记住用户名
    【css】谈谈 css 的各种居中——读编写高质量代码有感
    【javascript】图片左右滚动(可自动,有左右按钮)
    【转】ie6 png 透明终极解决方案
    【css3】一款可以让 ie 支持 css3 的插件
    【html】web 入门者必看的 html 代码编写的 30 条军规
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3051506.html
Copyright © 2020-2023  润新知