www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12572] New: pragma(lib, "curl") and -Lcurl broken

https://issues.dlang.org/show_bug.cgi?id=12572

          Issue ID: 12572
           Summary: pragma(lib, "curl") and -Lcurl broken
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

Currently it appears to be impossible to link against libcurl (at least on
Ubuntu 13.10 x64) without manually invoking the linker.

When adding pragma(lib, "curl") to a program, or by adding -Lcurl to dmd or
rdmd's command-line parameter, the program will still fail to link (the linker
complains about not being able to find symbols exported by libcurl). Running
dmd with -v reveals that it invokes the linker as follows:

gcc test.o -o test -m64 -L/etc/../lib -Xlinker --export-dynamic -lcurl
-l:libphobos2.a -lpthread -lm -lrt

Moving the "-lcurl" parameter to the end, as follows, resolves the linker
problems:

gcc test.o -o test -m64 -L/etc/../lib -Xlinker --export-dynamic -l:libphobos2.a
-lpthread -lm -lrt -lcurl

I'm marking this issue as critical since it makes std.net.curl incompatible
with rdmd, and it forces users to switch to a different method of building
their programs should they decide to use std.net.curl at some point in
development.

--
Apr 13 2014