How compile program with curl support?

David d at dav1d.de
Thu Aug 22 09:28:32 PDT 2013


Am 22.08.2013 15:27, schrieb ilya-stromberg:
> On Thursday, 22 August 2013 at 13:20:44 UTC, evilrat wrote:
>> why do u link phobos when compiler do this for you?
> 
> Because without it doesn't work:
> 
> $ dmd -L-lcurl main.d
> /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function
> `_D3std3net4curl4Curl19_sharedStaticCtor34FZv':
> std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor34FZv+0xf):
> undefined reference to `curl_global_init'
> /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function
> `_D3std3net4curl4Curl19_sharedStaticDtor35FZv':
> std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor35FZv+0x5):
> undefined reference to `curl_global_cleanup'
> 
> Have you got any ideas why?!

Can't reproduce this:

─[dav1d at archbox][/tmp]╼ cat c.d
import std.net.curl;

void main() {}
─[dav1d at archbox][/tmp]╼ dmd c.d
/usr/lib/libphobos2.a(curl.o): In function
`_D3std3net4curl4Curl19_sharedStaticCtor34FZv':
(.text._D3std3net4curl4Curl19_sharedStaticCtor34FZv+0xf): undefined
reference to `curl_global_init'
/usr/lib/libphobos2.a(curl.o): In function
`_D3std3net4curl4Curl19_sharedStaticDtor35FZv':
(.text._D3std3net4curl4Curl19_sharedStaticDtor35FZv+0x5): undefined
reference to `curl_global_cleanup'
collect2: Fehler: ld gab 1 als Ende-Status zurück
--- errorlevel 1
─[dav1d at archbox][/tmp]╼ dmd c.d -L-lcurl
─[dav1d at archbox][/tmp]╼

So I only get these errors when *not* linking against curl.


More information about the Digitalmars-d-learn mailing list