Build

Contents

Darling

Required Dependencies

  • clang 3.1+
  • GCC 4.6+ (yes, you still need GCC for header files)
  • libkqueue
  • libbsd
  • gnustep-base ("Foundation")
  • gnustep-gui ("Cocoa")
  • gnustep-corebase ("CoreFoundation") - you must use Darling's dev branch
  • gnustep-opal ("Core Graphics")
  • jgis ("JavaVM.framework") - only if you need this framework
  • libobjc2
  • libudev
  • openssl
  • libssh (for runtest)

Multilib Build

Multilib means that you're building both the 64-bit and 32-bit version on a 64-bit system.

Build the project out-of-source and define a SUFFIX, i.e.:

cd darling
mkdir -p build/32
mkdir -p build/64

cd build/32
CC=clang CXX=clang++ cmake ../.. -DSUFFIX=32
make
# make install...

cd ../build/64
CC=clang CXX=clang++ cmake ../.. -DSUFFIX=64
make
# make install...

32-bit Dependencies on 64-bit System

It is easy to get 32-bit versions of dependencies on a 64-bit Gentoo Linux.

CPPFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32 -L/usr/lib32" CFLAGS="-m32" CHOST=i686-pc-linux-gnu CBUILD=i686-pc-linux-gnu CTARGET=i686-pc-linux-gnu ABI=x86
  emerge -1 --buildpkgonly --nodeps libobjc2

Manually emerge all dependencies it can't find. Repeat with libcxx, libbsd, libgnustep-base and so on. Then extract .so files from /usr/portage/packages into /usr/local/lib32. Remove --buildpkgonly to merge into the filesystem.

Ordinary Build

Just force the compiler to Clang.

cd darling
CC=clang CXX=clang++ cmake .
make
# make install

Never forget to run ldconfig after make install!

Optional Dependencies

Grand Central Dispatch (GCD)

This guide is incomplete and broken.

1. Install libkqueue (CC=clang ./configure ...) 2. Install libpthread_workqueue (CC=clang ./configure ...) 3. Check out https://github.com/nickhutchinson/libdispatch.git (git clone ...)

CFLAGS="-D__BLOCKS__ -O2 -fblocks" KQUEUE_CFLAGS="-I/usr/local/include/kqueue" KQUEUE_LIBS="-lkqueue" LDFLAGS="-lkqueue -lpthread_workqueue -pthread -lm -l:libobjc.so.4" ./configure

You may need to fix /usr/include/unistd.h by changing the single occurence of __block to anything else (because idiots in charge of glibc will do nothing to avoid a naming conflict).

Then you probably need to fix src/internal.h to include different headers for the blocks runtime. Change

#include <Block_private.h>
#include <Block.h>

to this:

#include <objc/blocks_runtime.h>
#include <objc/blocks_private.h>

Running Applications

"Singlelib" system

dyld osx-program arguments...

"Multilib" system

For 64-bit programs:

dyld64 osx-program arguments...

For 32-bit programs:

dyld32 osx-program arguments...

In case of FAT Mach-O files containing both a 64-bit and a 32-bit executable, the appropriate one is chosen when using dyld64/32.