-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linker error when using curl #501
Comments
Confirmed. It happens with ldc2, too. |
Quite funny. I understand why ldmd2 and ldc2 causes a linker error. (The library name is not passed to the linker.) |
Which OS do you use? With dmd automatic linking using pragma(lib) works on Windows because the linker command is stored in the object file. On ELF based systems (Linux, FreeBSD), this is not supported. In this case dmd fails with a linker error, too. I am going to add the Windows behaviour to ldc. Does this fix your error? |
@redstar: Wait a second: As far as I'm aware pragma(lib) is supposed to be picked up irrespective of the linker commands being stored into object files or not. The problem with std.net.curl, at least for DMD on Linux, is that it sits in the standard library, which is linked after the before-unused symbols from libcurl have already been discarded: http://d.puremagic.com/issues/show_bug.cgi?id=7044 |
How I understand the source is that the library name is only picked up for the module which is currently compiled.
I examined the source not too close so I may miss here something. And I only checked on FreeBSD as I messed up my Gentoo installation. |
I did use the windows 32bit mingw version. |
@redstar: I just checked the behavior of DMD on OS X, and it seems as if you are indeed right, i.e. the linker flag is only added when the module containing the I think what I was thinking of was some build tool (DSSS?) that actually read those directives from files you included and adjusted its actions accordingly. |
do not only compile, but also run unittests on windows
|
From what I gather from recent PR discussions, Martin is working on dynamic loading of libcurl in upstream Phobos. This will finally resolve this situation. |
Clarification: this issue is fixed on platforms which have a toolchain which supports embedding of library references. This is only Windows with use of MS link. MinGW also uses COFF (the only object format which supports this) but uses the binutil ld which ignores this directive ( |
Using std.net.curl and compiling with ldmd2 causes a linker error because ldmd2 does not link automatically against libcurl (dmd does).
The text was updated successfully, but these errors were encountered: