[Ur] Static compilation on Mac OSX - can't be done, so fall back to next best
Adam Chlipala
adamc at csail.mit.edu
Wed Jul 17 10:30:24 EDT 2013
I can believe that a reasonable patch could be constructed to implement
some change like you describe, possibly involving alterations to the
'configure' process to detect new sorts of limitations of the host
platform. I think it's prohibitively difficult for me to work on
changes of this sort, since I've never owned an Apple product and don't
have plans to, but I'd certainly be happy to accept a patch increasing
Ur/Web's platform compatibility.
On 06/26/2013 12:12 AM, Daniel Patterson wrote:
> Apparently Mac OSX prevents static compilation from working by not
> providing static versions of basic libraries. This is active policy [1].
>
> The next best approximation is to link in what we can provide
> statically, and still have a dynamically linked binary, but hopefully
> one with minimal dependencies. An easy approximation to this is to take
> the exact command-line invocation that is currently generated with
> -static, and remove the -static keyword to gcc. The binary produced by
> this will not be dynamically linked against liburweb or liburweb_http,
> but still will be against ssl, crypto, sqlite3, and libSystem. However,
> at least on the system I'm experimenting on (10.7 - with some libraries,
> perhaps these, installed through homebrew), all of those but libSystem
> exist as static libraries, and by replacing -lssl (and company) by paths
> to libssl.a (and company), I get a binary that looks like this:
>
> $ otool -L app.exe
> app.exe:
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 159.1.0)
>
> Which I think could be considered optimal for the system. I'm not sure
> how exactly this should be done - I don't know gcc (or mac osx) well
> enough to know how to get it to track down all the static libraries that
> it can while not failing if there are some it cannot. But, I think this
> would be a better way of doing "static linking" on this system that is
> hostile to it.
>
> Thoughts? Is this an easy fix?
>
> 1. http://developer.apple.com/library/mac/#qa/qa1118/_index.html
>
More information about the Ur
mailing list