[Ur] Statically linking Ur/Web runtime

Benjamin Barenblat bbaren at mit.edu
Tue Aug 2 19:47:01 EDT 2016


On Tue, Aug 2, 2016 at 3:50 PM, Adam Chlipala <adamc at csail.mit.edu> wrote:
> There's already a static linking command-line option (not enabled by
> default), though I think it has some unresolved rough edges.
>
> I like dynamic linking for the scenario of many separate Ur/Web apps running
> on one server, which relates to some plans I have for the near future.

As far as I can tell, urweb -static just passes -static to the
underlying C compiler, which doesn’t really work on GNU systems.  glibc
uses dlopen(3) pretty pervasively, so you can’t generally link it
statically.  I’d prefer the default behaviour to be for urweb to link
the runtime statically while still linking libc, libssl, libcrypto,
etc. dynamically.  Then, the -static flag would link everything
statically, and we could add a -dynamic flag to link everything
dynamically.

For what it’s worth, this is basically how GHC works.  Depending on how
you feel about GHC, that may be an argument in favour or against. :)



More information about the Ur mailing list