Using std.net.curl
Gary Willoughby
dev at kalekold.net
Sun Jul 1 09:59:59 PDT 2012
I'm using the built-in curl library on Linux i'm getting linker
errors. I've installed libcurl4-openssl-dev and it works fine as
i can successfully compile a sample program. However when using
the D lib i get these errors:
[quote]
:!rdmd api_test.d
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl.o):
In function `_D3std3net4curl4Curl19_sharedStaticCtor28FZv':
std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor28FZv+0xf):
undefined reference to `curl_global_init'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl.o):
In function `_D3std3net4curl4Curl19_sharedStaticDtor29FZv':
std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor29FZv+0x5):
undefined reference to `curl_global_cleanup'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fa_140.o):
In function `_D3std3net4curl4HTTP4Impl6__dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP4Impl6__dtorMFZv+0x19):
undefined reference to `curl_slist_free_all'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fa_140.o):
In function `_D3std3net4curl4HTTP3dupMFZS3std3net4curl4HTTP':
std/net/curl.d:(.text._D3std3net4curl4HTTP3dupMFZS3std3net4curl4HTTP+0x6b):
undefined reference to `curl_slist_append'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fa_140.o):
In function `_D3std3net4curl4HTTP19clearRequestHeadersMFZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP19clearRequestHeadersMFZv+0x22):
undefined reference to `curl_slist_free_all'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fa_140.o):
In function `_D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv+0x5b):
undefined reference to `curl_slist_append'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fb_ea.o):
In function `_D3std3net4curl3FTP4Impl6__dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl3FTP4Impl6__dtorMFZv+0x18):
undefined reference to `curl_slist_free_all'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fb_ea.o):
In function `_D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP':
std/net/curl.d:(.text._D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP+0xa6):
undefined reference to `curl_slist_append'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fb_ea.o):
In function `_D3std3net4curl3FTP13clearCommandsMFZv':
std/net/curl.d:(.text._D3std3net4curl3FTP13clearCommandsMFZv+0x20):
undefined reference to `curl_slist_free_all'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_13fb_ea.o):
In function `_D3std3net4curl3FTP10addCommandMFAxaZv':
std/net/curl.d:(.text._D3std3net4curl3FTP10addCommandMFAxaZv+0x31):
undefined reference to `curl_slist_append'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1400_432.o):
In function `_D3std3net4curl4Curl10initializeMFZv':
std/net/curl.d:(.text._D3std3net4curl4Curl10initializeMFZv+0x42):
undefined reference to `curl_easy_init'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1401_149.o):
In function `_D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl':
std/net/curl.d:(.text._D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl+0x28):
undefined reference to `curl_easy_duphandle'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1405_37c.o):
In function `_D3std3net4curl4Curl8shutdownMFZv':
std/net/curl.d:(.text._D3std3net4curl4Curl8shutdownMFZv+0x1e):
undefined reference to `curl_easy_cleanup'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1407_14c.o):
In function
`_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv+0x35):
undefined reference to `curl_easy_setopt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1408_14c.o):
In function
`_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv+0x2e):
undefined reference to `curl_easy_setopt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1409_14c.o):
In function
`_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv+0x2e):
undefined reference to `curl_easy_setopt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_140a_207.o):
In function
`_D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv':
std/net/curl.d:(.text._D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv+0x26):
undefined reference to `curl_easy_setopt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_140b_2fb.o):
In function `_D3std3net4curl4Curl7performMFbZi':
std/net/curl.d:(.text._D3std3net4curl4Curl7performMFbZi+0x23):
undefined reference to `curl_easy_perform'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libphobos2.a(curl_1403_4a1.o):
In function `_D3std3net4curl4Curl11errorStringMFiZAya':
std/net/curl.d:(.text._D3std3net4curl4Curl11errorStringMFiZAya+0x11):
undefined reference to `curl_easy_strerror'
collect2: ld returned 1 exit status
--- errorlevel 1
shell returned 1
[/quote]
I found this error which looks like what i'm getting posted on
Stackoverflow:
http://stackoverflow.com/questions/10095150/std-net-curl-linker-errors-in-linux
Is there a fix for this? It looks like the linker parameters are
in the wrong order.
More information about the Digitalmars-d-learn
mailing list