D issues are now
tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Summary: |
dmd link library paths not given precedence over gcc defaults |
Product: |
D
|
Reporter: |
John Belmonte <john> |
Component: |
dmd | Assignee: |
John Belmonte <john> |
Status: |
RESOLVED
FIXED
|
Severity: |
enhancement
|
CC: |
bugzilla
|
Priority: |
P2
|
Version: |
D2 |
Hardware: |
All |
OS: |
Linux |
Given a machine with globally installed D libraries such as phobos2 which appear in gcc's default library paths, dmd provides no way to supply a library path with higher precedence. Any -L-L/path/... given to dmd will have lower precedence. This makes it very difficult to manage local dmd installs, where it's essential to override any globally installed versions of the phobos2 library. Likewise for any third-party D libraries which one may be developing.
I believe the problem stems from dmd's inconsistent use of the -Xlinker flag. The -l and -L link options exist in both native gcc and pass-through forms (latter by way of -Xlinker or -Wl. The dmd link line uses the gcc native form for -l, but the pass-through form for -L. This pattern appears to give precedence to gcc's default library paths during library searches.
If link.c is changed to use native gcc options for both -l and -L, the library paths supplied to -L will be given precedence over gcc default paths.