Bug 16962 – rdmd --build-only --force -c main.d fails: ./main: No such file or directory

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
tools
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2016-12-11T02:03:00Z
Last change time
2017-01-16T23:24:27Z
Keywords
pull
Assigned to
nobody
Creator
timothee.cour2
See also
https://issues.dlang.org/show_bug.cgi?id=16978

Comments

Comment #0 by timothee.cour2 — 2016-12-11T02:03:21Z
main.d: void main(){} rdmd --build-only --force -c main.d fails: ./main: No such file or directory also tried with -of=main.o and -ofmain.o IIRC that used to work. rdmd build 20161118 DMD64 D Compiler v2.072.0 std.file.FileException@std/file.d(679): ./main: No such file or directory ---------------- 4 rdmd 0x000000010d8648ca @trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(char)*, immutable(char)[], ulong) + 150 5 rdmd 0x000000010d8c64c8 @trusted void std.file.renameImpl(const(char)[], const(char)[], const(char)*, const(char)*) + 84 6 rdmd 0x000000010d866308 @safe void std.file.rename!(immutable(char)[], immutable(char)[]).rename(immutable(char)[], immutable(char)[]) + 252 7 rdmd 0x000000010d84645d int rdmd.rebuild(immutable(char)[], immutable(char)[], immutable(char)[], immutable(char)[], const(immutable(char)[][immutable(char)[]]), immutable(char)[][]) + 2649 8 rdmd 0x000000010d844827 _Dmain + 5327 9 rdmd 0x000000010d8ac3f7 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39 10 rdmd 0x000000010d8ac323 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35 11 rdmd 0x000000010d8ac39c void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 44 12 rdmd 0x000000010d8ac323 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35 13 rdmd 0x000000010d8ac289 _d_run_main + 497 14 rdmd 0x000000010d844a2f main + 15 15 libdyld.dylib 0x00007fff85a195ac start + 0 16 ??? 0x0000000000000004 0x0 + 4
Comment #1 by timothee.cour2 — 2016-12-11T02:09:26Z
these also fail: mkdir temp rdmd --build-only --force -lib -od=temp/ main.d [email protected](489): should have been created by compileRootAndGetDeps rdmd --build-only --force -lib -of=temp/main.a main.d [email protected](489): should have been created by compileRootAndGetDeps rdmd --build-only --force -lib -oftemp/main.a main.d std.file.FileException@std/file.d(679): temp/main.a: No such file or directory rdmd --build-only --force -lib -odtemp/ main.d std.file.FileException@std/file.d(679): temp/main.a: No such file or directory
Comment #2 by timothee.cour2 — 2016-12-11T02:10:57Z
as well as: rdmd --build-only --force -lib -odtemp/ -o- main.d [email protected](95): Option -o- currently not supported by rdmd
Comment #3 by timothee.cour2 — 2016-12-11T02:36:46Z
also broken: rdmd --build-only --force -od=/tmp/bar/ main.d std.file.FileException@std/file.d(679): =/tmp/bar/main: No such file or directory => rdmd doesn't seem to understand the new '=' syntax in '-od=' even though dmd does (DMD64 D Compiler v2.072.1) the only thing that works is: rdmd --build-only --force -lib -od/tmp/bar/ main.d rdmd --build-only --force -od/tmp/bar/ main.d but NOT these: s/-od/-od=/ s/-lib/-c/ or when we replace absolute path in od by relative path
Comment #4 by andrej.mitrovich — 2016-12-11T14:23:33Z
https://github.com/dlang/tools/commit/a63233c22dce33ff91141c5706cdc7d66a8c0099 seems to have caused the regression for the first test-case.
Comment #5 by andrej.mitrovich — 2016-12-11T14:38:09Z
(In reply to Andrej Mitrovic from comment #4) > https://github.com/dlang/tools/commit/ > a63233c22dce33ff91141c5706cdc7d66a8c0099 seems to have caused the regression > for the first test-case. That's a merge commit, it was specifically 10ca158.
Comment #6 by ag0aep6g — 2016-12-11T17:00:32Z
Found another one while looking into this: https://issues.dlang.org/show_bug.cgi?id=16966 Regarding the bugs here: The -of=/-od= thing (comment 3) seems to be a simple oversight. rdmd has just not been thought of when the feature was implemented in dmd. Should be easy to fix. -o- not working (comment 2) seems to a deliberate restriction. Supporting -c as in the summary may be some work. I must have missed that scenario completely when doing <https://github.com/dlang/tools/pull/194>. Problem is that rdmd now treats the root module specially: compiles it separately, links everything together in a separate step. That doesn't go naturally with -c, as far as I see. May have to detect -c and do things completely different then. -lib not working with relative paths (comment 3) seems odd. I hope it's just a simple bug, and not a design flaw. I haven't investigated. I'm going to look into this further, but it may take me a while. If anyone else wants to have a go, that would be great.
Comment #7 by dlang-bugzilla — 2016-12-11T20:37:14Z
Sorry, what is the use case of using -c ? I think it working was a mere accident. If you want to syntax-check the file, use dmd (not rdmd) with -o-. Or do you want to compile everything into a single object file for some reason?
Comment #8 by dlang-bugzilla — 2016-12-11T20:40:15Z
There is a known problem with -lib and -od: https://issues.dlang.org/show_bug.cgi?id=14296 Admittedly it's my fault as my commit introduced the regression, however the underlying bug is that DMD treats -od differently depending on whether -lib is passed or not, which I did not expect.
Comment #9 by timothee.cour2 — 2016-12-11T21:45:31Z
>> Sorry, what is the use case of using -c ? I think it working was a mere accident. If you want to syntax-check the file, use dmd (not rdmd) with -o-. Or do you want to compile everything into a single object file for some reason? Use case: when dmd's built-in linker magic isn't good enough (eg http://forum.dlang.org/post/[email protected] where i have to first compile then link to get -pie but I keep running into similar issues where i want to link seperately because the default isn't good enough)
Comment #10 by andrei — 2016-12-12T01:17:57Z
It may indeed be worthwhile to support -c as in "solve all dependencies and produce a big .o file ready for linking". There is no easy way to do that with either dmd or rdmd. Alternatively we could use a --no-link flag but -c seems more direct. Vladimir, what do you think?
Comment #11 by dlang-bugzilla — 2016-12-12T07:54:12Z
ag0aep6g: Since implementing -c directly is more complicated with the recent changes, can we emulate by using -lib and extracting the lib file's contents or such? Timothee, can you substitute -c with -lib in your use case? If so, we could fix the -od problem and make -c an explicitly unsupported switch like -o-.
Comment #12 by dlang-bugzilla — 2016-12-12T08:44:01Z
ag0aep6g: There is now an outdated comment in rdmd: // When building libraries, DMD does not generate object files. // Instead, it uses the -od parameter as the location for the library file. // Thus, override objDir (which is normally a temporary directory) // to be the target output directory. DMD will now use -c even with -lib. Was this something that changed due to your recent changes?
Comment #13 by dlang-bugzilla — 2016-12-12T08:44:23Z
(In reply to Vladimir Panteleev from comment #12) > DMD will now use -c even with -lib. rdmd, not DMD
Comment #14 by dlang-bugzilla — 2016-12-17T14:38:43Z
Another regression: issue 16978 Since there has been no reply from ag0aep6g for 5 days, I am going to revert that PR and add tests for the regressions. Then they or anyone else can have a go at it.
Comment #15 by dlang-bugzilla — 2016-12-17T16:02:21Z
Comment #16 by github-bugzilla — 2016-12-24T11:03:25Z
Commits pushed to stable at https://github.com/dlang/tools https://github.com/dlang/tools/commit/b6ec807712a452a47f712364b86d02335af2a93f Fix Issue 16962 - rdmd --build-only --force -c main.d fails: ./main: No such file or directory The actual fix was done by the revert. This simply adds a test. 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 <[email protected]>
Comment #17 by github-bugzilla — 2017-01-07T02:56:16Z
Commits pushed to master at https://github.com/dlang/tools https://github.com/dlang/tools/commit/b6ec807712a452a47f712364b86d02335af2a93f Fix Issue 16962 - rdmd --build-only --force -c main.d fails: ./main: No such file or directory https://github.com/dlang/tools/commit/bfbcd086bad634066ba142964823f1689e879aaf Merge pull request #207 from CyberShadow/issue-16962
Comment #18 by timothee.cour2 — 2017-01-07T04:34:07Z
Split of the bug pertaining to -of= -od= to https://issues.dlang.org/show_bug.cgi?id=17064
Comment #19 by github-bugzilla — 2017-01-16T23:24:27Z
Commits pushed to newCTFE at https://github.com/dlang/tools https://github.com/dlang/tools/commit/b6ec807712a452a47f712364b86d02335af2a93f Fix Issue 16962 - rdmd --build-only --force -c main.d fails: ./main: No such file or directory https://github.com/dlang/tools/commit/bfbcd086bad634066ba142964823f1689e879aaf Merge pull request #207 from CyberShadow/issue-16962