$ 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.
(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
https://github.com/D-Programming-Language/dmd/pull/4753
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
(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
A better solution for now is to have rdmd not use both -od and -of.
(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.
(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.
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.
https://github.com/dlang/tools/pull/207
Commits pushed to stable at https://github.com/dlang/tools https://github.com/dlang/tools/commit/e245e29d8bebe4d3965dbee40216135df513bccf Fix Issue 14296 - RDMD fails at building a lib when the source is in a subdir https://github.com/dlang/tools/commit/bfbcd086bad634066ba142964823f1689e879aaf Merge pull request #207 from CyberShadow/issue-16962 rdmd fixes (issues 14296, 16962 and 16978) merged-on-behalf-of: Martin Nowak <code@dawg.eu>
Commits pushed to master at https://github.com/dlang/tools https://github.com/dlang/tools/commit/e245e29d8bebe4d3965dbee40216135df513bccf Fix Issue 14296 - RDMD fails at building a lib when the source is in a subdir https://github.com/dlang/tools/commit/bfbcd086bad634066ba142964823f1689e879aaf Merge pull request #207 from CyberShadow/issue-16962
Commits pushed to newCTFE at https://github.com/dlang/tools https://github.com/dlang/tools/commit/e245e29d8bebe4d3965dbee40216135df513bccf Fix Issue 14296 - RDMD fails at building a lib when the source is in a subdir https://github.com/dlang/tools/commit/bfbcd086bad634066ba142964823f1689e879aaf Merge pull request #207 from CyberShadow/issue-16962