Skip to content
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

objfile not output in current directory #166

Open
JohanEngelen opened this issue Oct 24, 2015 · 5 comments
Open

objfile not output in current directory #166

JohanEngelen opened this issue Oct 24, 2015 · 5 comments

Comments

@JohanEngelen
Copy link
Contributor

The command sdc ../test.d outputs files a.out and ../test.o.
I would have expected that test.o would be created in the current directory, instead of in the same path as the input D file. This is what dmd does.
The fix for this is easy, let me know if desired.
(also, looking at the code in main.d, I think the extension should be fully stripped from the input file before generating the objfilename, instead of just removing the last 2 characters, in case someone has files named test.dlang or whathaveyou)

@deadalnix
Copy link
Contributor

It is not obvious as you can have several modules that share the same filename. What makes the most sense is to keep the folder that are packages, and drop the ones above this.

@JohanEngelen
Copy link
Contributor Author

I think I do not agree... This is about the default place to put build artifacts, which for the compilers that I know is in the current folder. It'd be very strange to strip only part of the path, no?
Where should this command put the output?
sdc ../../phobos/std/array.d
(it's really just the default that is strange, I find. I think in practice one would specify the output location, which unfortunately cannot be done just yet with SDC (more PRs incoming))

@deadalnix
Copy link
Contributor

Going back over the whole list of things, this one is interesting. I get where you are coming from and I think there is a legitimate point to it, but the solution didn't quite work. Should we rebase the path on top of the current directory? Mange the fully qualified module name in the filename?

@JohanEngelen
Copy link
Contributor Author

this has been a while! :)
I think a good solution is to only output a.out when no output file is specified, and basically force the user to specify an output filename (isn't that what GCC, Clang, but also LDC and DMD do?)

@deadalnix
Copy link
Contributor

I think #271 would be the right solution here. I tied not in my brain for no reason: . is not valid as a module name, so it can naturally be used as a separator and we can emit all the object files we want.

GCC, clang &al will chose a name by default if none is specified, however, we do have packages/module, so we shoudl take advantage of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants