Comment #0 by bus_dbugzilla — 2015-03-16T20:54:06Z
$ mkdir src
$ touch src/test.d
$ rdmd --build-only -lib src/test.d
std.file.FileException@std/file.d(409): src/test.a: No such file or directory
$ ls src/
src test.d
$ ls src/src/
test.a.tmp
This used to work with the RDMD packaged in DMD v2.064.2, but fails starting with RDMD 2.065.0.
Comment #1 by dlang-bugzilla — 2015-03-18T14:47:09Z
(In reply to Nick Sabalausky from comment #0)
> This used to work with the RDMD packaged in DMD v2.064.2, but fails starting
> with RDMD 2.065.0.
It didn't exactly work as one would expect in 2.064.2 either, did it? It still repeated the leading path component, it just didn't crash.
The real bug is in DMD: it interprets -of / -od differently depending on whether -lib is supplied.
There isn't much that can be done on rdmd's side, other than adding detection for .lib and explicitly working around the DMD bug, so it should be fixed in DMD instead.
https://issues.dlang.org/show_bug.cgi?id=14305
Comment #2 by bus_dbugzilla — 2015-06-19T03:53:43Z
Comment #3 by bus_dbugzilla — 2015-06-21T05:27:20Z
This can be worked around by giving -of an absolute path:
$ rdmd --build-only -lib src/test.d
Fails
$ rdmd --build-only -lib -oflib/hi.a src/test.d
Fails
$ rdmd --build-only -lib -of`pwd`/lib/hi.a src/test.d/
OK
Comment #4 by bus_dbugzilla — 2015-06-21T05:28:29Z
(In reply to Nick Sabalausky from comment #3)
>
> $ rdmd --build-only -lib -of`pwd`/lib/hi.a src/test.d/
> OK
That should've been:
$ rdmd --build-only -lib -of`pwd`/lib/hi.a src/test.d
OK
Comment #5 by bugzilla — 2015-07-11T23:33:43Z
A better solution for now is to have rdmd not use both -od and -of.
Comment #6 by dlang-bugzilla — 2015-07-21T12:09:15Z
(In reply to Walter Bright from comment #5)
> A better solution for now is to have rdmd not use both -od and -of.
That would mean to either put the intermediary object files in the current directory or to put the .lib file in a temporary directory. Again it would mean special logic in rdmd depending on whether -lib is supplied to work around the DMD bug.
Comment #7 by bugzilla — 2015-07-23T10:15:46Z
(In reply to Vladimir Panteleev from comment #6)
> (In reply to Walter Bright from comment #5)
> > A better solution for now is to have rdmd not use both -od and -of.
>
> That would mean to either put the intermediary object files in the current
> directory or to put the .lib file in a temporary directory. Again it would
> mean special logic in rdmd depending on whether -lib is supplied to work
> around the DMD bug.
dmd is not going to change the behavior of -od or -of. Their behavior is confusing enough - breaking peoples' makefiles will make things even worse. Best case is adding a new switch with the desired behavior.
rdmd can work by using fully qualified output file names.
Comment #8 by bugzilla — 2015-07-23T10:20:33Z
BTW, every file name generation algorithm in DMD is different from every other one. It is extremely bad design. Frankly, we should design a new set of flags and do it consistently, and then undocument the existing ones.
Meanwhile, rdmd should simply use fully qualified names and avoid the issue entirely.
Comment #9 by dlang-bugzilla — 2016-12-17T16:02:33Z