std.net.curl and ldc v1.0.0+

Joseph Rushton Wakeling via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon Sep 26 11:52:04 PDT 2016


Hello all,

I've run into a nasty little issue with `std.net.curl` and ldc 
v1.0.0.  If I build v1.0.0 freshly from source, and then use it 
to compile the following tiny program:

////////////////////////////////////////////////

void main ()
{
     import std.net.curl : get;
     auto website = "http://dlang.org/".get;
}

////////////////////////////////////////////////

... the program compiles correctly, but when I run it, I get a 
segfault.  A stacktrace is given here:
https://forum.dlang.org/post/cxfrbiwccxdnmrkuufwe@forum.dlang.org

This doesn't however occur if I build my program with the 
pre-built ldc v1.0.0 downloadable from GitHub.

I'm guessing this is in some way related to the fact that as of 
ldc v1.0.0, libcurl.so is dynamically loaded at runtime rather 
than being linked to phobos at build time.  So this makes me 
wonder: is there something extra required when building LDC that 
I might be missing?  I note that dmd now automatically links 
against libdl in order to support dynamic loading of libraries:
https://github.com/dlang/dmd/commit/541d9b61cd1792535cd4c99c418b42273bb9baa5

... so could I be missing something similar when building LDC?

I note that if I manually link in -ldl when compiling my program 
above, it makes no difference to the segfault.

Can anyone advise what could be wrong?

Thanks & best wishes,

     -- Joe


More information about the digitalmars-d-ldc mailing list