[Ur] Statically linking Ur/Web runtime

Adam Chlipala adamc at csail.mit.edu
Fri Aug 5 16:44:59 EDT 2016


I'm quite happy to add this as an additional mode.  It might even make 
sense as the default.

I think my current motivation level is low enough that it will need to 
wait for someone else to contribute a patch, though. ;)

P.S.: Clearly GHC embodies many careful and well-justified design 
decisions, but I do think they have less ambitious performance targets 
than I do with Ur/Web.  With many Ur/Web apps running simultaneously on 
one machine, duplicating the runtime system can make a big difference 
for memory usage (especially if many of the apps are tiny!).

On 08/02/2016 07:47 PM, Benjamin Barenblat wrote:
> 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