···27272828For complete instructions, visit [DarlingHQ.org](http://www.darlinghq.org/build-instructions).
29293030-#### For running x86-64 OS X binaries
3131-3230<a href="http://teamcity.dolezel.info/viewType.html?buildTypeId=Darling_DebianStableX8664&guest=1">
3331<img src="http://teamcity.dolezel.info/app/rest/builds/buildType:(id:Darling_DebianStableX8664)/statusIcon" title="Debian stable build for x86-64"/>
3432</a>
···61596260````
6361cd darling
6464-mkdir -p build/x86-64
6565-cd build/x86-64
6666-cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86_64.cmake
6262+mkdir build
6363+cd build
6464+cmake ../ -DCMAKE_TOOLCHAIN_FILE=../Toolchain.cmake
6765make
6866make install
6967````
70687171-#### For running i386 OS X binaries
7272-7373-<a href="http://teamcity.dolezel.info/viewType.html?buildTypeId=Darling_DebianStableX8664&guest=1">
7474-<img src="http://teamcity.dolezel.info/app/rest/builds/buildType:(id:Darling_DebianStableX8664)/statusIcon" title="Debian stable build for i386"/>
7575-</a>
7676-7777-Required additional dependencies (on top of x86_64 dependencies)
7878-7979-Debian (stable) / Ubuntu (15.10):
8080-8181-```
8282-$ sudo apt-get install libc6-dev-i386 libudev-dev:i386 lib32stdc++-4.9-dev
8383-```
8484-8585-Arch Linux (4.8):
8686-8787-```
8888-$ sudo pacman -S lib32-libstdc++5 lib32-clang
8989-```
9090-9191-````
9292-cd darling
9393-mkdir -p build/i386
9494-cd build/i386
9595-cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86.cmake
9696-make
9797-make install
9898-````
9999-100100-#### Building and loading the kernel module (x86-64 and i386)
6969+#### Building and loading the kernel module
1017010271````
10372# Go into src/lkm to build the kernel module
104104-cd ../../src/lkm
7373+cd ../src/lkm
10574make
10675make install
10776````
···1107911180````
11281# Go into src/lkm to build the kernel module
113113-cd ../../src/lkm
8282+cd ../src/lkm
11483sudo ./dkms.sh
11584````
11685···174143175144Congratulations, you have just compiled and run your own Hello world application with Apple's toolchain.
176145177177-178178-### AppKit
179179-180180-AppKit is still highly experimental and incomplete, but to work on it you need to configure CMake with `-DFRAMEWORK_APPKIT=1` and install some additional packages.
181181-182182-Ubuntu 16.04:
183183-```
184184-sudo apt install qt5-default qtquick1-5-dev qtscript5-dev qtdeclarative5-dev
185185-186186-```
-88
README.md.old
···11-This is a userspace compatibility layer for running Darwin/OS X binaries on Linux.
22-33-# General information
44-55-For more information visit http://www.darlinghq.org
66-77-**Build instructions** are avaiable here: http://www.darlinghq.org/build-instructions
88-99-# Hacking tutorial
1010-1111-Want to help? Visit the developer zone at http://www.darlinghq.org/developer-zone
1212-1313-## Directory tree
1414-1515-<dl>
1616-1717-<dt>benchmarks/</dt>
1818-<dd>No serious stuff in here, used only once for a simple ObjC msg sending benchmark.</dd>
1919-<dt>etc/</dt>
2020-<dd>Contains dylib.conf which is used to map OS X library (framework) paths to Linux/Darling ones. `/dev/null` = load nothing.</dd>
2121-<dt>include/</dt>
2222-<dd>Header files taken from Darwin/OS X (APSL license). The plan is to get rid of these eventually.</dd>
2323-<dt>misc/</dt>
2424-<dd>Random files, nothing that really matters.</dd>
2525-<dt>src/</dt>
2626-<dd>Source code, see below.</dd>
2727-<dt>tests/</dt>
2828-<dd>Test runner. It is specifically designed to work on my testing setup. See below.</dd>
2929-<dt>tests/src/</dt>
3030-<dd>The source code for tests.</dd>
3131-<dt>tools/</dt>
3232-<dd>Various utilities used during the development.</dd>
3333-3434-</dl>
3535-3636-### Source tree
3737-3838-The structure under `src/`.
3939-4040-<dl>
4141-<dt>src/libSystem/</dt>
4242-<dd>Wrappers or implementation of libc funcions, BSD system calls and Mach system calls.</dd>
4343-4444-<dt>src/libobjcdarwin/</dt>
4545-<dd>Loader of ObjC classes/protocols in Mach-O ObjC applications. Contains code for selector fixups and other techniques needed to "make it work" with GNUstep's libobjc2.</dd>
4646-4747-<dt>src/util/</dt>
4848-<dd>Various utility functions/classes common to all parts of Darling.</dd>
4949-5050-<dt>src/libmach-o/</dt>
5151-<dd>Mach-O parsing/loading library.</dd>
5252-5353-<dt>src/dyld/</dt>
5454-<dd>The dynamic loader.</dd>
5555-5656-<dt>src/motool/</dt>
5757-<dd>A very simple tool for Mach-O file examination. (An allusion to "otool" available on OS X.)</dd>
5858-5959-<dt>src/crash/</dt>
6060-<dd>A crash ("force quit") dialog app for Cocoa apps. Not really complete yet.</dd>
6161-6262-<dt>...</dt>
6363-<dd>The rest is code or wrappers in various stages of completion.</dd>
6464-6565-</dl>
6666-6767-### Tests tree
6868-6969-The testing procedure implemented in `src/tests/runtest.cpp` is as follows:
7070-7171-1. It copies the source file to the OS X machine.
7272-2. It remotely builds the source file. If the current binary name is `runtest32`, then `-m32` is added and `dyld32` is used later on. A similar `runtest64` symlink is needed if your 64-bit dyld is called `dyld64`. If the first line in the source file is `// CFLAGS:`, then the rest is used as CFLAGS.
7373-3. It remotely runs the program and keeps its stdout.
7474-4. It copies the binary over to the local machine.
7575-5. It runs the binary via dyld/dyld32/dyld64.
7676-6. It compares the stdout contents of dyld with that of the remotely run binary.
7777-7. Should the stdout contents differ or should the process exit with a non-zero code on either of the systems, the test has failed.
7878-7979-## Debugging
8080-8181-Find out how Darling can help you with debugging at http://www.darlinghq.org/for-developers/debugging-in-darling
8282-8383-## What NOT to do
8484-8585-To avoid mistakes:
8686-8787-* DO NOT use opencflite and similar Apple CFLite forks, unless you know what you're doing. They lack bridging support with gnustep-base. Bridging between gnustep-corebase and -base is at least work in progress. Should CFLite forks ever fix a bug for you, please help fix the problem in gnustep-corebase.
8888-