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

David J Kordsmeier dkords at gmail.com
Wed Oct 9 01:10:23 UTC 2019


On Tuesday, 8 October 2019 at 22:23:39 UTC, Jon Degenhardt wrote:
> 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).

Thank you all forum folks for the replies.  My use case for curl 
is simply HTTP/HTTPS, not libcurl specifically.  That said, I was 
making a best effort to not use external dependencies per my 
requirements.  My feeling is that a platform should provide needs 
for modern computing, and web is a part of that.  I hope this 
question "goes away" in the future and there becomes a modern 
library alternative to the std.net for http as standard part of 
phobos.

So a number of great responses here, and I am going to explore 
the export option as well as the http2 (from arsd) option.  John, 
I'll check out the tsv-utils build as well, your CI server set up 
looks really great.  I am very interested to learn the best 
practices of distribution of prebuilt D apps and libraries.


More information about the Digitalmars-d mailing list