[Haskell-cafe] Dynamically linking frameworks on macOS

Ryan Trinkle ryan.trinkle at gmail.com
Fri Jun 30 19:34:55 UTC 2017


Ah, interesting; thanks for the info!  In that case, I'll just go back to
debugging that issue the old fashioned way.


Best,
Ryan

On Tue, Jun 27, 2017 at 10:33 AM, Daniel Peebles <pumpkingod at gmail.com>
wrote:

> I don't know about your specific issue with Foundation.framework, but
> regarding "Apple doesn't support (and strongly discourages) statically
> linked executables[1], 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>
> wrote:
>
>> 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[1], so it's not terribly surprising that this doesn't
>> work.
>>
>> Is there anything I can do to avoid the need for -dynamic here?
>>
>>
>> Thanks,
>> Ryan
>>
>> [1] https://developer.apple.com/library/content/qa/qa1118/_index.html
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170630/804ca1a7/attachment.html>


More information about the Haskell-Cafe mailing list