On Sun, Jul 1, 2012 at 10:59 AM, Gary Willoughby <[email protected]> wrote:
> 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 `_**D3std3net4curl4HTTP3dupMFZS3st**d3net4curl4HTTP': > std/net/curl.d:(.text._**D3std3net4curl4HTTP3dupMFZS3st**d3net4curl4HTTP+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 `_**D3std3net4curl4HTTP19clearRequ**estHeadersMFZv': > std/net/curl.d:(.text._**D3std3net4curl4HTTP19clearRequ**estHeadersMFZv+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 `_**D3std3net4curl4HTTP16addReques**tHeaderMFAxaAxaZv': > std/net/curl.d:(.text._**D3std3net4curl4HTTP16addReques**tHeaderMFAxaAxaZv+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 `_**D3std3net4curl3FTP3dupMFZS3std**3net4curl3FTP': > std/net/curl.d:(.text._**D3std3net4curl3FTP3dupMFZS3std**3net4curl3FTP+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 `_**D3std3net4curl3FTP13clearComma**ndsMFZv': > std/net/curl.d:(.text._**D3std3net4curl3FTP13clearComma**ndsMFZv+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 `_**D3std3net4curl3FTP10addCommand**MFAxaZv': > std/net/curl.d:(.text._**D3std3net4curl3FTP10addCommand**MFAxaZv+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 `_**D3std3net4curl4Curl10initializ**eMFZv': > std/net/curl.d:(.text._**D3std3net4curl4Curl10initializ**eMFZv+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 `_**D3std3net4curl4Curl3dupMFZS3st**d3net4curl4Curl': > std/net/curl.d:(.text._**D3std3net4curl4Curl3dupMFZS3st**d3net4curl4Curl+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 `_**D3std3net4curl4Curl8shutdownMF**Zv': > std/net/curl.d:(.text._**D3std3net4curl4Curl8shutdownMF**Zv+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 `_**D3std3net4curl4Curl3setMFE3etc**1c4curl10CurlOptionAxaZv': > std/net/curl.d:(.text._**D3std3net4curl4Curl3setMFE3etc** > 1c4curl10CurlOptionAxaZv+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 `_**D3std3net4curl4Curl3setMFE3etc**1c4curl10CurlOptionlZv': > std/net/curl.d:(.text._**D3std3net4curl4Curl3setMFE3etc**1c4curl10CurlOptionlZv+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 `_**D3std3net4curl4Curl3setMFE3etc**1c4curl10CurlOptionPvZv': > std/net/curl.d:(.text._**D3std3net4curl4Curl3setMFE3etc**1c4curl10CurlOptionPvZv+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 `_**D3std3net4curl4Curl5clearMFE3e**tc1c4curl10CurlOptionZv': > std/net/curl.d:(.text._**D3std3net4curl4Curl5clearMFE3e**tc1c4curl10CurlOptionZv+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 `_**D3std3net4curl4Curl7performMFb**Zi': > std/net/curl.d:(.text._**D3std3net4curl4Curl7performMFb**Zi+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 `_**D3std3net4curl4Curl11errorStri**ngMFiZAya': > std/net/curl.d:(.text._**D3std3net4curl4Curl11errorStri**ngMFiZAya+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<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. > I just ended up specifying the link command manually (see my answer on the Stack Overflow). It's ugly but it works. Leandro discusses a solution here: <http://d.puremagic.com/issues/show_bug.cgi?id=7044#c1> It hasn't been implemented yet though. Regards, Brad Anderson
