mGSTEP
 
F A Q    |    Graphics    |    Notes    |    LLVM    |    Demos    |    Home   
 
Building with LLVM (clang) and the Libobjc2 runtime

Initial support for building mGSTEP with the clang compiler (LLVM 3.8.1) and Libobjc2 runtime (libobjc2-1.8) has been added. Most of the AppKit and Foundation examples are functional, but the build remains noisy (warnings) so a variety of issues may be lurking. Support for Libobjc2 required significant changes to the NSThread and NSLock classes. The changes are employed only when the GCC runtime is not used. Though the changes appear to be a better solution, they also require more thorough testing.

Avoiding namespace collisions during the build and at runtime is critical when multiple compilers and Objective-C runtimes are installed. On my dev platform clang is not the system compiler, Libobjc2 is not the default runtime and there's also a Linux port of Apple's CoreFoundation-Lite installed. Building in this environment requires a make command line that explicitly specifies clang and prefers Libobjc2. I also move the CoreFoundation-Lite headers to avoid conflicts with mGSTEP's internal mini CoreFoundation. Tune the following to your environment:
PATH="$HOME/toolchains/bin:$PATH" \
LD_LIBRARY_PATH="$HOME/toolchains/lib64:$HOME/libobjc2/lib" \
LFLAGS=" -Wl,-rpath,$HOME/toolchains/lib64 -L$HOME/toolchains/lib64 -L/usr/X11/lib -L$HOME/libobjc2/lib" \
CC=clang CFLAGS=" -fblocks -I$HOME/libobjc2/include" \
make

Known issues
  • Automatic Reference Counting (ARC) is not supported although some plumbing for it was added.
  • Support for three Obj-C runtimes is a challenge (legacy GCC, GCC with Apple inspired API and Libobjc2).
  • Forwarding is broken.
  • Distributed Objects is also broken (requires method forwarding).
  • Loading the about panel NIB crashes some examples without this Libobjc2-1.8.x patch.
  • Compiler warnings must be resolved.