www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Using std.net.curl

reply "Gary Willoughby" <dev kalekold.net> writes:
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/l
bphobos2.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/l
bphobos2.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/libphobos
.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/libphobos
.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/libphobos
.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/libphobos
.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._D3std3net4curl4Curl3setMFE3etc1c4curl10Cu
lOptionAxaZv+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._D3std3net4curl4Curl3setMFE3etc1c4curl10
urlOptionlZv+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._D3std3net4curl4Curl3setMFE3etc1c4curl10C
rlOptionPvZv+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._D3std3net4curl4Curl5clearMFE3etc1c4curl1
CurlOptionZv+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.
Jul 01 2012
next sibling parent Brad Anderson <eco gnuk.net> writes:
--bcaec517a7908ded1004c4042428
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Jul 1, 2012 at 10:59 AM, Gary Willoughby <dev kalekold.net> 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 --bcaec517a7908ded1004c4042428 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sun, Jul 1, 2012 at 10:59 AM, Gary Willoughby <span dir=3D"ltr">&lt;<a h= ref=3D"mailto:dev kalekold.net" target=3D"_blank">dev kalekold.net</a>&gt;<= /span> wrote:<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quot= e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I&#39;m using the built-in curl library on Linux i&#39;m getting linker err= ors. I&#39;ve installed libcurl4-openssl-dev and it works fine as i can suc= cessfully compile a sample program. However when using the D lib i get thes= e errors:<br> <br> [quote]<br> :!rdmd api_test.d<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_<u></u>sharedStati= cCtor28FZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl19_<u></u>sharedStaticCtor= 28FZv+0xf): undefined reference to `curl_global_init&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_<u></u>sharedStati= cDtor29FZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl19_<u></u>sharedStaticDtor= 29FZv+0x5): undefined reference to `curl_global_cleanup&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fa_140.o): In function `_D3std3net4curl4HTTP4Impl6__<u><= /u>dtorMFZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4HTTP4Impl6__<u></u>dtorMFZv+0x= 19): undefined reference to `curl_slist_free_all&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fa_140.o): In function `_<u></u>D3std3net4curl4HTTP3dupM= FZS3st<u></u>d3net4curl4HTTP&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4HTTP3dupMFZS3st<u></u>d3net4cu= rl4HTTP+0x6b): undefined reference to `curl_slist_append&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fa_140.o): In function `_<u></u>D3std3net4curl4HTTP19cle= arRequ<u></u>estHeadersMFZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4HTTP19clearRequ<u></u>estHeade= rsMFZv+0x22): undefined reference to `curl_slist_free_all&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fa_140.o): In function `_<u></u>D3std3net4curl4HTTP16add= Reques<u></u>tHeaderMFAxaAxaZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4HTTP16addReques<u></u>tHeaderM= FAxaAxaZv+0x5b): undefined reference to `curl_slist_append&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fb_ea.o): In function `_D3std3net4curl3FTP4Impl6__<u></u=
dtorMFZv&#39;:<br>

8): undefined reference to `curl_slist_free_all&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fb_ea.o): In function `_<u></u>D3std3net4curl3FTP3dupMFZ= S3std<u></u>3net4curl3FTP&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl3FTP3dupMFZS3std<u></u>3net4cur= l3FTP+0xa6): undefined reference to `curl_slist_append&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fb_ea.o): In function `_<u></u>D3std3net4curl3FTP13clear= Comma<u></u>ndsMFZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl3FTP13clearComma<u></u>ndsMFZv+= 0x20): undefined reference to `curl_slist_free_all&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_13fb_ea.o): In function `_<u></u>D3std3net4curl3FTP10addCo= mmand<u></u>MFAxaZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl3FTP10addCommand<u></u>MFAxaZv+= 0x31): undefined reference to `curl_slist_append&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1400_432.o): In function `_<u></u>D3std3net4curl4Curl10ini= tializ<u></u>eMFZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl10initializ<u></u>eMFZv+0x= 42): undefined reference to `curl_easy_init&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1401_149.o): In function `_<u></u>D3std3net4curl4Curl3dupM= FZS3st<u></u>d3net4curl4Curl&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl3dupMFZS3st<u></u>d3net4cu= rl4Curl+0x28): undefined reference to `curl_easy_duphandle&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1405_37c.o): In function `_<u></u>D3std3net4curl4Curl8shut= downMF<u></u>Zv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl8shutdownMF<u></u>Zv+0x1e)= : undefined reference to `curl_easy_cleanup&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1407_14c.o): In function `_<u></u>D3std3net4curl4Curl3setM= FE3etc<u></u>1c4curl10CurlOptionAxaZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl3setMFE3etc<u></u>1c4curl1= 0CurlOptionAxaZv+0x35)<u></u>: undefined reference to `curl_easy_setopt&#39= ;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1408_14c.o): In function `_<u></u>D3std3net4curl4Curl3setM= FE3etc<u></u>1c4curl10CurlOptionlZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl3setMFE3etc<u></u>1c4curl1= 0CurlOptionlZv+0x2e): undefined reference to `curl_easy_setopt&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1409_14c.o): In function `_<u></u>D3std3net4curl4Curl3setM= FE3etc<u></u>1c4curl10CurlOptionPvZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl3setMFE3etc<u></u>1c4curl1= 0CurlOptionPvZv+0x2e): undefined reference to `curl_easy_setopt&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_140a_207.o): In function `_<u></u>D3std3net4curl4Curl5clea= rMFE3e<u></u>tc1c4curl10CurlOptionZv&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl5clearMFE3e<u></u>tc1c4cur= l10CurlOptionZv+0x26): undefined reference to `curl_easy_setopt&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_140b_2fb.o): In function `_<u></u>D3std3net4curl4Curl7perf= ormMFb<u></u>Zi&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl7performMFb<u></u>Zi+0x23)= : undefined reference to `curl_easy_perform&#39;<br> /usr/lib/gcc/x86_64-linux-gnu/<u></u>4.6/../../../x86_64-linux-gnu/<u></u>l= ibphobos2.a(curl_1403_4a1.o): In function `_<u></u>D3std3net4curl4Curl11err= orStri<u></u>ngMFiZAya&#39;:<br> std/net/curl.d:(.text._<u></u>D3std3net4curl4Curl11errorStri<u></u>ngMFiZAy= a+0x11): undefined reference to `curl_easy_strerror&#39;<br> collect2: ld returned 1 exit status<br> --- errorlevel 1<br> <br> shell returned 1<br> [/quote]<br> <br> I found this error which looks like what i&#39;m getting posted on Stackove= rflow:<br> <br> <a href=3D"http://stackoverflow.com/questions/10095150/std-net-curl-linker-= errors-in-linux" target=3D"_blank">http://stackoverflow.com/<u></u>question= s/10095150/std-net-<u></u>curl-linker-errors-in-linux</a><br> <br> Is there a fix for this? It looks like the linker parameters are in the wro= ng order.<br> </blockquote></div><br><div>I just ended up specifying the link command man= ually (see my answer on the Stack Overflow). =A0It&#39;s ugly but it works.= =A0Leandro discusses a solution here: &lt;<a href=3D"http://d.puremagic.co= m/issues/show_bug.cgi?id=3D7044#c1">http://d.puremagic.com/issues/show_bug.= cgi?id=3D7044#c1</a>&gt;=A0It hasn&#39;t been implemented yet though.</div> <div><br></div><div>Regards,</div><div>Brad Anderson</div> --bcaec517a7908ded1004c4042428--
Jul 04 2012
prev sibling next sibling parent 1100110 <10equals2 gmail.com> writes:
Specifying them in the oposite order one the command line worked for me a  
few days ago.

I swear.



On Sun, 01 Jul 2012 11:59:59 -0500, Gary Willoughby <dev kalekold.net>  
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/l
bphobos2.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/l
bphobos2.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/libphobos
.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/libphobos
.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/libphobos
.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/libphobos
.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._D3std3net4curl4Curl3setMFE3etc1c4curl10Cu
lOptionAxaZv+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._D3std3net4curl4Curl3setMFE3etc1c4curl10
urlOptionlZv+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._D3std3net4curl4Curl3setMFE3etc1c4curl10C
rlOptionPvZv+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._D3std3net4curl4Curl5clearMFE3etc1c4curl1
CurlOptionZv+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.

-- Using Opera's revolutionary email client: http://www.opera.com/mail/
Jul 06 2012
prev sibling parent "Gary Willoughby" <dev kalekold.net> writes:
Yeah invoking the linker manually works fine.

To save me from that each time i've actually added '-L-lphobos2' 
to the end of 'DFLAGS' in '/etc/dmd.conf' so phobos is always 
before curl in the linker argument list. When the program is 
compiled '-L-lphobos2' appears twice in the args but that's no 
big deal (i hope :p ).

Thanks.
Jul 07 2012