Thread overview
[2.061] -unittest => /usr/bin/ld: cannot find -lcurl
Jan 04, 2013
Philippe Sigaud
Jan 04, 2013
Andrej Mitrovic
Jan 04, 2013
Jonathan M Davis
Jan 04, 2013
Philippe Sigaud
Jan 04, 2013
Jonathan M Davis
Jan 04, 2013
Philippe Sigaud
Jan 04, 2013
David Nadlinger
Jan 04, 2013
Philippe Sigaud
Jan 04, 2013
Andrej Mitrovic
January 04, 2013
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.





January 04, 2013
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.
January 04, 2013
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
January 04, 2013
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?


January 04, 2013
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
January 04, 2013
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.


January 04, 2013
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
January 04, 2013
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

January 04, 2013
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.