-
-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 3541 - Add -oq switch to use fully qualified module for the object file name #1871
Conversation
|
I don't understand these permission denied errors, the script works fine locally. |
@9rnsr: Do you know why I'm getting permission denied error on the shell script? I've run |
Git independently manages file permissions. |
Thanks Kenji, it finally greens. I'll wait for reviews. |
I don't really understand the point of this. Just use -of to set a specific path/name for the output file. Also, the current scheme of picking output filenames is a confusing mess, with different schemes for each output file kind. I am loathe to add yet another layer on top of that. (see Module::setOutfile() and LibOMF::setFilename() and mars.c line 1499, for starters. |
This is meant to be used with the Using
For example a sequence of calls by a build tool:
|
'_' is fragile: alternatives: b) some kind of mangling indicating number of package nesting levels: works because package name can't start with a number (right ?) c) use another character, say @: |
Good catch. LDC seems to use dots in the filename, I guess to keep compatibility we should probably do the same. |
…as object file name.
Reimplemented, now using periods instead of underscores. This should keep compatibility with scripts which already used LDC's -oq option. @ibuclaw: I assume you've probably implemented or know how |
I don't see that this adds much value over -op. Why is it needed? |
One advantage in addition to not creating a full directory structure is that it's much easier to properly place object files in case of the source code being somewhere else than the current directory. Example:
So instead of in the "obj" folder, everything is now cluttered over the initial folder because the whole path to the source file is used to determine the destination directory. "-oq" on the other hand nicely fills the "obj" folder no matter where the sources come from. In the VisualD project generator of DUB I have to specify dummy path entries to account for this, which is really just an ugly hack: Disclaimer: I didn't actually test this, so it may be slightly off, but you get the idea... |
Indeed pretty ugly.
Just to clarify this because I didn't got it until I tried ldc. cat > foo.d << CODE
module bar;
CODE
dmd -c -oq foo.d
ls bar.o |
What prevents merging this? I've filed another bug (http://d.puremagic.com/issues/show_bug.cgi?id=12116) and then implemented support for -oq (which works) but then remembered about this thread after 1 Andrej redirected me to http://d.puremagic.com/issues/show_bug.cgi?id=3541. |
@WalterBright are you against this? |
ping: it's been 4 years, this is blocking incremental compilation @ghost @WalterBright @andralex |
@timotheecour could you explain how this is a blocker? Simple scripting around |
@andralex : because ldc has implemented -oq a long time ago and it works. It makes no sense to have it there and not in dmd. |
@andralex, will this PR(or another one implementing -oq) be accepted [once made up to date] ? |
@timotheecour @WalterBright is the gatekeeper of the cmdline options, and @MartinNowak is the master of change |
The audit trail for this pull request is difficult to follow. There were already 2 other pull requests that were merged: #169 and #563
This issue and PR could use a summary to make review and/or revival more efficient. |
I'm not a fan of I agree the dummy folder necessary for dub is ugly, maybe it's simpler to just convert the path to a file name, e.g. by replacing |
I'm not a fan of that either.
This switch cannot be implemented in gdc. |
My suggestion would be to generate the object file name from the module file name plus a crc32 or similar of the directory portion. This is what I did for DUB's single-file mode, to keep the overall path length sane and not run into path length issues on Windows. |
@s-ludwig, if build tools already support this, then there's even less of an incentive to do it in the compiler. |
Something still needs to be done for multiple object files output mode, and there is an issue for DMD/COFF when run with the -lib switch and multiple modules in different packages have the same name, but apart from that I'd agree. |
This doesn't seem to have much support and lacks a champion to carry it forward. I suggest it be closed. Any objections? |
No objections raised. Closing. |
http://d.puremagic.com/issues/show_bug.cgi?id=3541