Issue a nicer error message if critical envvars are missing#7256
Issue a nicer error message if critical envvars are missing#7256andralex wants to merge 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request, @andralex! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
| ##### Directories | ||
|
|
||
| # DM_HOME should be defined in the user's environment | ||
| DM_HOME=Please_define_the__DM_HOME__environment_variable |
There was a problem hiding this comment.
I never set DM_HOME (and the required naming does not fit my installation), the C compiler already knows its standard include folders.
There was a problem hiding this comment.
@rainers what if it's in a non-default location?
There was a problem hiding this comment.
dmc is not in the default location on my system, but in c:\l\dmc instead. It uses sc.ini, too, containing INCLUDE="%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE% which points to the standard include folders.
There was a problem hiding this comment.
Cool, then can you please submit a small PR to eliminate it entirely? Also it would be great if you also updated the wiki instructions. Thx!
There was a problem hiding this comment.
See #7260
The wiki uses DM_HOME to refer to the DMD installation directory, that seems ok.
| # D compiler (set with env variable) | ||
| #HOST_DC=dmd | ||
| # For error detection: | ||
| HOST_DC=Please_define_the__HOST_DC__environment_variable |
There was a problem hiding this comment.
This works to display a nicer error, but it no longer allows setting HOST_DC in the environment. It is only overwritten on the command line.
There was a problem hiding this comment.
On wine at least it works with HOST_DC set in the environment.
There was a problem hiding this comment.
Could you try it on native Windows? Thx!
There was a problem hiding this comment.
That's what I did. Are you sure to invoke DigitalMars make?
An explicit test of the variables works, too, but has to be added as a dependency to the defaulttarget and maybe others:
checkvars:
cmd /c if "$(HOST_DC)" == "" (echo Please set HOST_DC && exit 1)
(DM make does not seem to interpret the result of executing an implicit shell command, so I had to make it explicit).
There was a problem hiding this comment.
Interesting, I'll look into this. For what it's worth I use wine make -f win32.mak that I assume uses dmd make, but I'll check when I get back to that machine.
There was a problem hiding this comment.
BTW we could also set the DC_HOST variable to dmd which is the default that's used for posix.mak and then simply add a nice error message as @rainers suggested.
(if DM make supports this)
There was a problem hiding this comment.
I tried to get this "default" functionality working with DM make and failed...
|
@andralex Does this have a future? |
|
See also #7467 |
|
@JinShil I don't have a Windows machine handy so it's difficult for me to test things properly. Do you think you can adopt this? It's fairly simple. |
|
Going with #7467 |
Currently the behavior if someone forgets to define HOST_DMD is quite bizarre - the makefile creates a file called
src/-and make issues an incomprehensible error message pointing to lexer.lib. This fixes that.