[Haskell-cafe] Dynamically linking frameworks on macOS
pumpkingod at gmail.com
Tue Jun 27 14:33:16 UTC 2017
I don't know about your specific issue with Foundation.framework, but
regarding "Apple doesn't support (and strongly discourages) statically
linked executables, so it's not terribly surprising that this doesn't
work." I think you're interpreting it a bit more broadly than intended.
Apple's point in that tech note is that you shouldn't statically link what
most people think of as libc (called libSystem on macOS). You can
statically link anything else because that's basically just you deciding
how you want to organize your software. The reason for this is that
libSystem is where the kernel syscall wrappers live, and they don't want
you to make syscalls directly because they don't want to commit to a
particular kernel ABI. That's why they don't ship a static libSystem or any
of that crt0.o stuff, but if you have a ton of .a libraries you want to
link into your executable that's fine because it'll still be linking to
libSystem.dylib when it wants to make syscalls.
The only mainstream project I know that actively ignores this advice is Go,
which has implemented its own syscall wrappers for macOS and as such
occasionally gets weird bugs when Apple makes changes to the kernel ABI.
On Fri, Jun 23, 2017 at 11:31 AM, Ryan Trinkle <ryan.trinkle at gmail.com>
> Hi everyone,
> I'm trying to ensure that beginner-level code that uses reflex-dom can be
> built by simply calling 'ghc myFile.hs', provided that all the necessary
> libraries are available in ghc-pkg. This works on linux, but on macOS,
> it's currently necessary for the user to add '-dynamic' to the command
> line. In particular, without -dynamic, the linker fails to find
> "_OBJC_CLASS_$_NSURL", which is a symbol in the Foundation system
> framework. Apple doesn't support (and strongly discourages) statically
> linked executables, so it's not terribly surprising that this doesn't
> Is there anything I can do to avoid the need for -dynamic here?
>  https://developer.apple.com/library/content/qa/qa1118/_index.html
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe