Executed (as per readme https://github.com/influxdata/telegraf#build-from-source )

git -c http.sslVerify=false clone https://github.com/influxdata/telegraf.git
cd telegraf

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

barts2108:
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

We don’t get a lot of folks building on Windows, but you are right it does look like the Makefile is currently broken in those environments. I have filed make: fails on Windows environments · Issue #11609 · influxdata/telegraf · GitHub to track this and to get a fix for you.

For now, you can manually run:

go build .\cmd\telegraf\

Which will pass a lot of the checks and other things that run during a build and get yourself a binary.

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

and add the EXEEXT to the tools to be built

build_tools:
$(HOSTGO) build -o ./tools/license_checker/license_checker$(EXEEXT) ./tools/license_checker
$(HOSTGO) build -o ./tools/readme_config_includer/generator$(EXEEXT) ./tools/readme_config_includer/generator.go

It seems to be able to build from a simple CMD.exe window.

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

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.

Thanks again!

Back here for a last update:

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

Start git-bash

"C:\Program Files\Git\git-bash.exe" --cd-to-home

cd to the folder you want to use for your build

git clone https://github.com/influxdata/telegraf.git

cd to the telegraf folder

Thanks for this!

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:

GOARCH=arm64 make
            

LATEST RELEASES Real-world AI starts with time series. Time series starts with InfluxDB 3.

Get the Updates