Error building metricbeat 7.12.0

Hi,

I'm trying to build metricbeat v7.12.0 and I'm getting this error:

    ~/beats/metricbeat    PLATFORMS=linux/amd64 make release                                                                    2 ↵  10463  17:57:51
    mage package
    Generated fields.yml for metricbeat to /Users/annayan/beats/metricbeat/fields.yml
    >> Building metricbeat.yml for linux/amd64
    >> Building metricbeat.reference.yml for linux/amd64
    >> Building metricbeat.docker.yml for linux/amd64
    Generated fields.yml for metricbeat to /Users/annayan/beats/metricbeat/build/fields/fields.all.yml
    exec: go list -m
    exec: go list -m
    >> golangCrossBuild: Building for linux/amd64
    >> buildGoDaemon: Building for linux/amd64
    >> Building using: cmd='build/mage-linux-amd64 buildGoDaemon', env=[CC=gcc, CXX=g++, GOARCH=amd64, GOARM=, GOOS=linux, PLATFORM_ID=linux-amd64]
    >> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=gcc, CXX=g++, GOARCH=amd64, GOARM=, GOOS=linux, PLATFORM_ID=linux-amd64]
    Error: expected 1 line, got 0 while looking for github.com/tsg/go-daemon
    Error: failed building for linux/amd64: exit status 1
    failed building for linux/amd64: exit status 1
    package ran for 2m48.90495088s
    Error: running "docker run --env EXEC_UID=501 --env EXEC_GID=20 -v /Users/annayan/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE= --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v /Users/annayan/beats:/go/src/github.com/elastic/beats -w /go/src/github.com/elastic/beats/metricbeat docker.elastic.co/beats-dev/golang-crossbuild:1.15.8-main-debian7 --build-cmd build/mage-linux-amd64 buildGoDaemon -p linux/amd64" failed with exit code 1
    make: *** [release] Error 1

Last version I tried to build was 7.7.0 and that was fine

My go version: go version go1.15.8 darwin/amd64
My mage:

    Mage Build Tool v1.11.0
    Build Date: <not set>
    Commit: <not set>
    built with: go1.15.8

fwiw I see github.com/tsg/go-daemon in my beats/vendor folder.

Any help is appreciated! Thanks

Hi!

Latest versions use go modules, so this is what you might be hitting. Please have a look into the contribution guide at Contributing to Beats | Beats Developer Guide [master] | Elastic

C.

Hey @ChrsMark , thanks for replying! I tried make update, and then mage vendor. Not sure where I should be running mage vendor in - running it in beats and beats/metricbeat both gives me an error Unknown target specified: "vendor", running it in beats/vendor gives me No .go files marked with the mage build tag in this directory..

@kvch does this look familiar to you? Any ideas here?

Just run simply rm -rf vendor in the root of Beats.

Just to be clear are you building your own Metrcibeat metricset or building Metricbeat on v7.12.0 from the beats repo?

I removed the vendor folder and now PLATFORMS=linux/amd64 make release works fine. I think I ran go mod vendor at first because mage build prompted me to, but now I can't reproduce that prompt. Thank you both for your help!

1 Like