Static linking D apps for distribution to the cloud, etc.

Jon Degenhardt jond at noreply.com
Tue Oct 8 22:23:39 UTC 2019


On Tuesday, 8 October 2019 at 19:35:03 UTC, kinke wrote:
> On Tuesday, 8 October 2019 at 18:28:14 UTC, David J Kordsmeier 
> wrote:
>> I'll go back and review the best practices for using curl with 
>> phobos.  I still am struggling to make this work, as something 
>> that would be relatively simple in C to perform (statically 
>> link to any libraries I would like).
>
> Phobos 2.069 switched to loading libcurl at runtime, see 
> https://dlang.org/changelog/2.069.0.html#curl-dynamic-loading. 
> It mentions that it's still possible to link it statically into 
> the executable.

The TSV Utilities have used static linking for Linux prebuilt 
release binaries for a couple years now without any problems. The 
tools do not use curl or gethostbyaddr, but there are still 
plenty of warning messages. (Example: 
https://travis-ci.org/eBay/tsv-utils/jobs/593432965)

Static linking was suggested by Jacob Carlborg, who pointed out 
that the pre-built binaries wouldn't run on all Linux 
distributions. Static linking fixed it, with no subsequent 
problems reported (https://github.com/eBay/tsv-utils/issues/67).


More information about the Digitalmars-d mailing list