Address: http://www.mulle-kybernetik.com/weblog/2011/10/how_to_build_libobjc_for_ OS _x.html
Max OS X: 10.6.8
Version to be compiled and run: 437.3
I just tried it myself and can compile it.
In addition, the header file contains an absolute path. If this is not good, you can change it to a relative path,
For example, use $ (SRCROOT) as a reference.
With their own modified project packaging: http://files.cnblogs.com/Proteas/objc-runtime_10.6.8_437.3.zip
After the download, you should be able to compile it directly. If you have any questions, leave a message.
Original article content:
This builds and links and work for me, but it hasn't been tested much so I don't make any guarantees.
Preparation
Create a directory where to store all the stuff. I chose/Usr/local/src/darwin- 10.6.8.
Prepare |
Sudo mkdir-p/usr/local/src/darwin-10.6.8 Sudo chmod 777/usr/local/src/darwin-10.6.8
|
Download and Unpack
Download the following packages:
- Libc-594.9.5.z
- Dyld-132.13
- Libauto-141.2
- Libclosure-38
- Libdispatch-84.5.5
- Objc4-437.3.
- Xnu-1504.15.3
Download |
Cd/usr/local/src/darwin- 10.6.8/ Curl-O http://www.opensource.apple.com/tarballs/Libc/Libc-594.9.5.tar.gz Curl-O http://www.opensource.apple.com/tarballs/dyld/dyld-132.13.tar.gz Curl-O http://www.opensource.apple.com/tarballs/libauto/libauto-141.2.tar.gz Curl-O http://www.opensource.apple.com/tarballs/libclosure/libclosure-38.tar.gz Curl-O http://www.opensource.apple.com/tarballs/libdispatch/libdispatch-84.5.5.tar.gz Curl-O http://www.opensource.apple.com/tarballs/objc4/objc4-437.3.tar.gz Curl-O http://www.opensource.apple.com/tarballs/xnu/xnu-1504.15.3.tar.gz
Tar xfz Libc-594.9.5.tar.gz Tar xfz dyld-132.13.tar.gz Tar xfz libauto-141.2.tar.gz Tar xfz libclosure-38.tar.gz Tar xfz libdispatch-84.5.5.tar.gz Tar xfz objc4-437.3.tar.gz
|
You can also manually download stuff fromhttp: // www.opensource.apple.com/release/mac-osx-1068 /.
Installation of Headers
Copy the needed headere/Usr/local/include/darwin- 10.6.8. The versioning of the destination directory is important, otherwise you might get some strange bugs later on in life.
Install |
Sudo mkdir-p/usr/local/include/darwin-10.6.8 Sudo chmod 777/usr/local/include/darwin-10.6.8 Cd/usr/local/include/Darwins-10.6.8 Mkdir libkern Mkdir System Mkdir System/i386 Mkdir System/ppc Mkdir System/machine Mkdir mach-oCd/usr/local/src/Darwins-10.6.8 # Find.-name "oscrosendian. h" # Find.-name "pthread_machdep.h" # Find.-name "dyld_priv.h" # Find.-name "cpu_capabilities.h" # Find.-name Block_private.h # Find.-name auto_zone.h Cp./xnu-1504.15.3/libkern/oscrosendian. h/usr/local/include/darwin-10.6.8/libkern/ Cp./Libc-594.9.5/pthreads/pthread_machdep.h/usr/local/include/darwin-10.6.8/System/ Cp./dyld-132.13/include/mach-o/dyld_priv.h/usr/local/include/darwin-10.6.8/mach-o/ Cp./xnu-1504.15.3/osfmk/i386/cpu_capabilities.h/usr/local/include/darwin-10.6.8/System/i386/ Cp./xnu-1504.15.3/osfmk/ppc/cpu_capabilities.h/usr/local/include/darwin-10.6.8/System/ppc/ Cp./xnu-1504.15.3/osfmk/machine/cpu_capabilities.h/usr/local/include/darwin-10.6.8/System/machine/ Cp./libclosure-38/Block_private.h/usr/local/include/darwin-10.6.8/ Cp./libauto-141.2/auto_zone.h/usr/local/include/darwin-10.6.8/
|
Change the Xcode Project of objc
Open objc4-437.3/*. xcodeproj
Open the project settings in Xcode and set:
- HEADER_SEARCH_PATHS =/usr/local/include/darwindows-10.6.8 $ (inherited)For all invocations
- GCC_PREPROCESSOR_DEFINITIONS = $ (inherited) PRIVATEFor Debug and
- GCC_PREPROCESSOR_DEFINITIONS = $ (inherited) NDEBUG PRIVATEFor Release
But this isn' t good enough yet. FixObjcTarget settings by prefixing$ (Inherited)ToHEADER_SEARCH_PATHSThusly
- HEADER_SEARCH_PATHS = $ (inherited) $ (DSTROOT)/usr/include/** $ (DSTROOT)/usr/local/include/** $ (CONFIGURATION_BUILD_DIR) /usr/include/** $ <(CONFIGURATION_BUILD_DIR)/usr/local/include /**
Then you shoshould go intoObjcTarget'sCompile sourcesSettings and move the fileObjc-probes.dTo the top, so that it gets compiled first.
And now it shoshould build and link without errors.
Go ahead and trash your system with the debug linked version