Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to compile and use objc runtime from apple's source code?

As is know to us all, objc's runtime is open source and can be downloaded from: http://www.opensource.apple.com/tarballs/objc4/

After I download the tarball an extract it. I open objc.xcodeproj using xcode. However, when I build it, there are many erros, such as, can not find some headers. I googled all the missing headers, download them, put them in /tmp/objc.dst/usr/include. But without luck, still errors.

I searched the internet, but I can find few documents or instructions about:

  1. how to compile apple's objc runtime from source code?
  2. After compile it , I should get libobjc.A.dylib, how to use it (as a replace of the system's libobjc.A.dylib) ?

I really appreciate any help you can provide.

like image 530
Kuangfeng Avatar asked Apr 01 '15 05:04

Kuangfeng


1 Answers

Compile with no error under 10.10.2(14C1514), Xcode 6.2 (6C131e).

  1. You need OSX 10.8 SDK, which you can get from early Xcode install dmg or this repository https://github.com/phracker/MacOSX-SDKs (If you download sdk from this repo, you may need to fix the soft links using this script http://blog.jeswang.org/blog/2014/10/26/fix-slash-soft-slash-links-slash-in-slash-an-slash-archived-slash-file/, you may need to run the script two times for the recursion of references)

  2. More the 10.8 sdk to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs

  3. Clone this repository https://github.com/Jeswang/objc4-532.2

  4. Compile and Run the debug-objc scheme

  5. You can set any breakpoint in the source and debug the whole runtime.

like image 192
jeswang Avatar answered Nov 12 '22 08:11

jeswang