git -c http.sslVerify=false clone https://github.com/influxdata/telegraf.git
cd telegraf
make
Then the info starts as this:
go mod download -x
# get https://proxy.golang.org/cloud.google.com/go/bigquery/@v/v1.33.0.mod
# get https://proxy.golang.org/cloud.google.com/go/@v/v0.102.1.mod
# get https://proxy.golang.org/cloud.google.com/go/@v/v0.102.1.mod: 200 OK (0.152s)
until 7488 lines later it fails with this
# get https://proxy.golang.org/sigs.k8s.io/yaml/@v/v1.2.0.zip
# get https://proxy.golang.org/sigs.k8s.io/yaml/@v/v1.2.0.zip: 200 OK (0.148s)
env -u GOOS -u GOARCH -u GOARM -- go build -o ./tools/license_checker/license_checker ./tools/license_checker
process_begin: CreateProcess(NULL, env -u GOOS -u GOARCH -u GOARM -- go build -o ./tools/license_checker/license_checker ./tools/license_checker, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [build_tools] Error 2
Probably I am doing something wrong, but can’t find out what.
I want to build telegraf on windows 10 for windows
The manual build runs and creates a 200MB executable. I guess that’s because of all plugins, but its not relevant for my case. I have subscribed to the github issue #11609 .
I have seen a lot of reactions in github while I was biking back home… About MingW and other things… My setup does not have MingW (yet). If I modify the makefile in this way : (removed the env command from HOSTGO as I do not know how to change it for windows … probably a set command or so)
GOARCH ?= $(shell go env GOARCH)
#HOSTGO := env -u GOOS -u GOARCH -u GOARM -- go
HOSTGO := go
ifeq ($(GOOS), windows)
EXEEXT := .exe
endif
Unfortunately I am new user and not allowed to upload my makefile. I will do another test from scratch from the git clone until compiling
Hey! I appreciate you trying to make it work.
#HOSTGO := env -u GOOS -u GOARCH -u GOARM -- go
HOSTGO := go
Unfortunately, this will re-introduce the cross-build issue. It does seem that users are running with powershell, as we got another issue today. We can continue in that issue and see where we get.
How about redefining HOSTGO in the if (windows) ?
EDIT: nevermind, I see the changes have been checked in already. I will see if I can start from scratch once more and if I can get everything compiling. If not, I might be coming back here with a question.
Using git-bash works, and now is able to build the executables for windows and linux on windows.
For those looking for the information how to use it, I managed to get it working with these steps
Start cmd.exe
set environment variable(s) GOOS, GOARCH, GOARM as required. If they are not set, it seems that the compilation by default is for the platform and architecture you’re running on. After setting the environment variables continue at next point
Should you need to change those Go variables, You should also be able to set on the command line in the git-bash shell. For example, if I wanted to cross-build for the arm64 architecture: