Thread overview
[Issue 4642] New: DMD should have a command-line option to ignore pragma(lib, ...)
Aug 14, 2010
Leandro Lucarella
Aug 14, 2010
Walter Bright
Aug 14, 2010
Walter Bright
Aug 14, 2010
Leandro Lucarella
August 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4642

           Summary: DMD should have a command-line option to ignore
                    pragma(lib, ...)
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: llucax@gmail.com


--- Comment #0 from Leandro Lucarella <llucax@gmail.com> 2010-08-13 18:05:23 PDT ---
I think is important to have an option to ignore pragma(lib, ..), because even when is not very common, users might want to link against an specific custom library name.

For example in Debian sometimes there are packages for the same library but configured in different ways, like libcurl and libcurl-gnutls.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4642


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2010-08-13 18:48:04 PDT ---
http://www.digitalmars.com/ctg/ctgLinkSwitches.html#defaultlibrarysearch

for dmd:  -L/nodefaultlibrarysearch

for non-Windows builds, it isn't an issue because the object file format does not have a field type for libraries.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4642


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4642


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #2 from Leandro Lucarella <llucax@gmail.com> 2010-08-13 20:14:41 PDT ---
(In reply to comment #1)
> http://www.digitalmars.com/ctg/ctgLinkSwitches.html#defaultlibrarysearch
> 
> for dmd:  -L/nodefaultlibrarysearch
> 
> for non-Windows builds, it isn't an issue because the object file format does not have a field type for libraries.

I don't use Windows, so I don't know the details about it, but I can't understand what you mean for non-Windows either.

The point is, if a library have a:

pragma (lib, "curl");

And I want to use libcurl-gnutls instead, I can't without modifying the source. Even more, if I don't even have the non-gnutls curl installed, I can't even compile.

For example:

p.d
---
import l;
void main() {}
---

l.d
---
pragma (lib, "curl");
---

$ dmd -v /tmp/p.d /tmp/l.d -of/tmp/p | grep curl
library   curl
gcc /tmp/p.o -o /tmp/p -m32 -Xlinker -L../lib -lcurl -lphobos -lpthread -lm
/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libcurl.so when searching for
-lcurl
/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libcurl.a when searching for
-lcurl
/usr/bin/ld: skipping incompatible //usr/lib/libcurl.so when searching for
-lcurl
/usr/bin/ld: skipping incompatible //usr/lib/libcurl.a when searching for
-lcurl
/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status

DMD adds the -lcurl and AFAIK, I can't change that without modifying the source of l.d (which might not be under my control, it could be a system-wide header for which I have no write-access, of course I could copy and modify it but I hope we agree that is less than ideal).

Is there any way to avoid that problem right now?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------