www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [2.061] -unittest => /usr/bin/ld: cannot find -lcurl

reply "Philippe Sigaud" <philippe.sigaud gmail.com> writes:
I updated to 2.061 and now, when I use rdmd with the -unittest 
flag, I have a strange error:

/usr/bin/ld: cannot find -lcurl

Why does it need curl?

It does that even with a simple Hello World (this is my go-to 
test module):

module test;

import std.algorithm;
import std.bigint;
import std.conv;
import std.datetime;
import std.format;
import std.math;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;
import std.typetuple;
import std.variant;

void main()
{
     writeln("Hello World!");
}

Note that I have no problem without the -unittest flag.

$ rdmd test.d

works. Also,

$ dmd -unittest test.d

works flawlessly: it's only with:

$ rdmd -unittest test.d

that the error appears.
Jan 03 2013
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/4/13, Philippe Sigaud <philippe.sigaud gmail.com> wrote:
 I updated to 2.061 and now, when I use rdmd with the -unittest
 flag, I have a strange error:

It was already filed, no responses yet though: http://d.puremagic.com/issues/show_bug.cgi?id=9007 It's become so annoying that I'm now running a filter script that removes warning messages from Optlink on win32.
Jan 03 2013
prev sibling next sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Friday, January 04, 2013 01:26:59 Philippe Sigaud wrote:
 I updated to 2.061 and now, when I use rdmd with the -unittest
 flag, I have a strange error:
 
 /usr/bin/ld: cannot find -lcurl
 
 Why does it need curl?

std.net.curl needs it, but AFAIK, it's supposed to be up to the programmer to link against when they actually need it rather than it happening automatically. I don't know what changed. - Jonathan M Davis
Jan 03 2013
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--047d7bea3e2670b0ca04d271ec63
Content-Type: text/plain; charset=UTF-8

On Fri, Jan 4, 2013 at 1:50 AM, Jonathan M Davis <jmdavisProg gmx.com>wrote:

 On Friday, January 04, 2013 01:26:59 Philippe Sigaud wrote:
 I updated to 2.061 and now, when I use rdmd with the -unittest
 flag, I have a strange error:

 /usr/bin/ld: cannot find -lcurl

 Why does it need curl?

std.net.curl needs it, but AFAIK, it's supposed to be up to the programmer to link against when they actually need it rather than it happening automatically. I don't know what changed.

I gathered std.net.curl needed it. But I do not import it. Is it somehow imported by the -unittest flag? --047d7bea3e2670b0ca04d271ec63 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Fri, Jan 4, 2013 at 1:50 AM, Jonathan= M Davis <span dir=3D"ltr">&lt;<a href=3D"mailto:jmdavisProg gmx.com" targe= t=3D"_blank">jmdavisProg gmx.com</a>&gt;</span> wrote:<br><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex"> <div class=3D"im">On Friday, January 04, 2013 01:26:59 Philippe Sigaud wrot= e:<br> &gt; I updated to 2.061 and now, when I use rdmd with the -unittest<br> &gt; flag, I have a strange error:<br> &gt;<br> &gt; /usr/bin/ld: cannot find -lcurl<br> &gt;<br> &gt; Why does it need curl?<br> <br> </div>std.net.curl needs it, but AFAIK, it&#39;s supposed to be up to the p= rogrammer to<br> link against when they actually need it rather than it happening<br> automatically. I don&#39;t know what changed.</blockquote><div><br></div><d= iv>I gathered std.net.curl needed it. But I do not import it. Is it somehow= imported by the -unittest flag?=C2=A0</div></div> --047d7bea3e2670b0ca04d271ec63--
Jan 04 2013
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Friday, January 04, 2013 09:04:06 Philippe Sigaud wrote:
 On Fri, Jan 4, 2013 at 1:50 AM, Jonathan M Davis <jmdavisProg gmx.com>wrote:
 On Friday, January 04, 2013 01:26:59 Philippe Sigaud wrote:
 I updated to 2.061 and now, when I use rdmd with the -unittest
 flag, I have a strange error:
 
 /usr/bin/ld: cannot find -lcurl
 
 Why does it need curl?

std.net.curl needs it, but AFAIK, it's supposed to be up to the programmer to link against when they actually need it rather than it happening automatically. I don't know what changed.

I gathered std.net.curl needed it. But I do not import it. Is it somehow imported by the -unittest flag

I have no idea. dmd _does_ specifically import some stuff rather than relying on dmd.conf (e.g. -lrt) in part to guarantee linking order IIRC, and IIRC there _were_ problems with libcurl and linking order on some Ubuntu systems. So, maybe something was done because of that. Maybe something was done to make it so that -lcurl was automatically added if std.net.curl was used and something with -unittest and Phobos ended up importing it? I wouldn't have thought so, but I really don't know what to tell you. This didn't used to happen, and I really don't know what changed. I can only guess. - Jonathan M Davis
Jan 04 2013
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--005045015d004d223504d276ec08
Content-Type: text/plain; charset=UTF-8

Thank you for the answer anyway :)

I'll dig into the code to see is something ends up calling std.net.curl.
Heck, I can also get curl somewhere, I guess.

--005045015d004d223504d276ec08
Content-Type: text/html; charset=UTF-8

Thank you for the answer anyway :)<div><br></div><div>I&#39;ll dig into the
code to see is something ends up calling std.net.curl. Heck, I can also get
curl somewhere, I guess.</div><div><br></div><div><br></div>

--005045015d004d223504d276ec08--
Jan 04 2013
prev sibling next sibling parent "David Nadlinger" <see klickverbot.at> writes:
On Friday, 4 January 2013 at 00:27:01 UTC, Philippe Sigaud wrote:
 I updated to 2.061 and now, when I use rdmd with the -unittest 
 flag, I have a strange error:

 /usr/bin/ld: cannot find -lcurl

 Why does it need curl?

The std.traits unittests apparently import etc.c.curl, which features a »pragma(lib, "curl");« declaration. Should be easy to swap it out for another module that doesn't produce any unintended side effects. David
Jan 04 2013
prev sibling next sibling parent "Philippe Sigaud" <philippe.sigaud gmail.com> writes:
On Friday, 4 January 2013 at 14:35:26 UTC, David Nadlinger wrote:
 The std.traits unittests apparently import etc.c.curl, which 
 features a »pragma(lib, "curl");« declaration. Should be easy 
 to swap it out for another module that doesn't produce any 
 unintended side effects.

Why does it activate for rdmd and not when compiling and running with DMD? Ah, maybe I get it: when it invokes dmd with the --deps flag, I guess DMD activates the pragma, even in unit tests. I made a bug report: http://d.puremagic.com/issues/show_bug.cgi?id=9269
Jan 04 2013
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/4/13, Philippe Sigaud <philippe.sigaud gmail.com> wrote:
 Ah, maybe I get it: when it invokes dmd with the --deps flag

I think RDMD uses -v actually, not the --deps flag.
Jan 04 2013