-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Building on Windows - The system cannot find the file specified #11735
Comments
Hello! I recommend posting this question in our Community Slack or Community Page, we have a lot of talented community members there who could help answer your question more quickly. You can also learn more about Telegraf by enrolling at InfluxDB University for free! Heads up, this issue will be automatically closed after 7 days of inactivity. Thank you! |
It's line 47 in the makefile: HOSTGO := env -u GOOS -u GOARCH -u GOARM -- go "env" is not a valid windows command. HOSTGO := go |
Hey, Are you both using powershell to run the Makefile? We had a previous issue where we tried to get powershell to work with Make, we ultimately decided it would be much easier to support the "Bash for Git" terminal on Windows. Trying to add additional if statements for Makefile in various places to handle the oddities of PowerShell became less and less appealing.
Right, however we need to unset these values when doing cross-builds. |
Thanks for chiming in!
In windows the command to unset an environment variable is SET with an empty value:
I have no idea how to take different paths in the makefile depending on the os |
Sorry, I didn't catch this bit before. Bash for git is a Martian object in Windows. Supporting software in Windows through Bash for Git is the equivalent of supporting software in linux through Wine. |
As are Makefiles/make, git, and go; all of which are dependencies required to build Telegraf using the Makefile. I treat using "bash" to use the Makefile as another dependency. I am not sure how else you would install git, but as a part of the install process getting bash for git is readily available.
The build yes, but if you look at the bug I linked to the problems do not end there. I am interested in the Makefile to just work in Windows and would be happy to see a PR to get it working, but at the same time, I'm not thrilled to support or maintain the additional complexity. I would also mention that our Windows builds are built using the Makefile in bash as well. It keeps things consistent for our build tooling across all three platforms. If we start adding PowerShell/Windows-specific options we have to ensure that Windows works with both PowerShell and/or bash.
Unfortunately, the problems do not end there. There are other commands mentioned in the bug above that also do not work. If we are going to support the Makefile in a PowerShell environment, then I believe we need to ensure we can depend on other subcommands as well. Otherwise, this is an endless trickle of issues. |
I see your point. My custom build invokes make from a powershell script, so I guess I will have to rewrite it in bash. Bummer. |
Let's make sure it's documented that windows builds require git bash so future users don't run into this. |
Looks like it's already in the main readme: |
The easiest way is to fail the build (with a meaningful message) if not running from bash. |
I agree, a helpful message would be best. I don't develop on windows much. I don't know of a good cross-platform way to check for this condition. We could run a windows command that will cause an error on linux, or run a linux command that will cause an error on windows. I suppose we could check |
I'm not that knowledgeable in makefiles, is it possible to catch and exception and return a custom error message? The other option I see is to check if Windows is being used (easy by checking env vars) and what's the current console (not easy... I found nothing about how to do that) then throw a custom error... I think the first option is the best as there might be other linux-like consoles that work on windows... |
The latest Telegraf code cannot be built on Windows you get the following error:
Note: under "support" as I couldn't fill the mandatory field for an issue
The text was updated successfully, but these errors were encountered: