When trying to build an Objective C program that uses the
-fobjc-arc flag (Automatic Reference Counting) using the clang stdenv, the linking fails with
ld: file not found: /nix/store/29sdvdbaj16kxgzhxj72pa1dn3vrf9bw-clang-7.1.0/lib/arc/libarclite_macosx.a
Searching for this issue, I found this blog post: https://blog.wadetregaskis.com/tot-clang-llvm-in-xcode/
If you try to compile a project that uses ARC, you’ll get an obnoxious linker error complaining about not being able to find libarclite_macosx.a. This is apparently some private Apple library that you cannot get the source to, let alone have bundled into the llvm repositories. Luckily, if you’re on Lion or later, you’ll find it already installed in /usr/lib/arc/. Copy that whole folder to the “lib” folder in your custom-built clang, and you’ll be good to go.
Does anyone know how to link against this file? Should it work automatically, with cctools perhaps? Any pointers would be appreciated.