Skip to content

Issue a nicer error message if critical envvars are missing#7256

Closed
andralex wants to merge 1 commit intodlang:masterfrom
andralex:win32.mak-error-detection
Closed

Issue a nicer error message if critical envvars are missing#7256
andralex wants to merge 1 commit intodlang:masterfrom
andralex:win32.mak-error-detection

Conversation

@andralex
Copy link
Copy Markdown
Member

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.

@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request, @andralex!

Bugzilla references

Your 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never set DM_HOME (and the required naming does not fit my installation), the C compiler already knows its standard include folders.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rainers what if it's in a non-default location?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On wine at least it works with HOST_DC set in the environment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try it on native Windows? Thx!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to get this "default" functionality working with DM make and failed...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, got it it to work (#7468).

@JinShil JinShil added the Review:WIP Work In Progress - not ready for review or pulling label Nov 26, 2017
@JinShil
Copy link
Copy Markdown
Contributor

JinShil commented Dec 19, 2017

@andralex Does this have a future?

@JinShil
Copy link
Copy Markdown
Contributor

JinShil commented Dec 19, 2017

See also #7467

@andralex
Copy link
Copy Markdown
Member Author

@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.

@JinShil
Copy link
Copy Markdown
Contributor

JinShil commented Dec 20, 2017

Do you think you can adopt this?

Is it not already being adopted with #7467 and #7468?

@JinShil
Copy link
Copy Markdown
Contributor

JinShil commented Jan 6, 2018

Going with #7467

@JinShil JinShil closed this Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants