Hello,
I am trying to create a new custom beat, after running "mage -v package" I get the error:
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/386: exit status 127
after investigating I found that the command:
docker run -it --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v /root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name-w /go/src/github.com/73986194/mybeat_name docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main --build-cmd /build/mage-linux-amd64 golangCrossBuild -p windows/amd64
is probably not mapping my local directory correctly because
the file /build/mage-linux-amd64 exists in my local directory /root/go/src/github.com/73986194/mybeat_name.
Any help would be appreciated.
Thanks
mage -v package full output:
Running target: Package
exec: go list -m
exec: go list -m -f {{.Dir}} github.com/elastic/beats/v7
Found Elastic Beats dir at /root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3
community_beat package spec loaded from [/root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3/dev-tools/packaging/packages.yml]
Running dependency: Update
exec: make update
Installing mage v1.10.0.
/root/.magefile cleaned
Running target: Fields
exec: go list -m
exec: go list -m -f {{.Dir}} github.com/elastic/beats/v7
Found Elastic Beats dir at /root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3
exec: go run -mod=readonly /root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3/libbeat/scripts/cmd/global_fields/main.go -es_beats_path /root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3 -beat_path /root/go/src/github.com/73986194/mybeat_name-out fields.yml
Generated fields.yml for mybeat_nameto /root/go/src/github.com/73986194/mybeat_name/fields.yml
Running target: Config
exec: go list -m
exec: go list -m -f {{.Dir}} github.com/elastic/beats/v7
Found Elastic Beats dir at /root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3
>> Building mybeat_name.yml for linux/amd64
>> Building mybeat_name.reference.yml for linux/amd64
>> Building mybeat_name.docker.yml for linux/amd64
Updating generated files for mybeat_name
mkdir -p include
go run /root/go/pkg/mod/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20201230145114-b498aa3527f3/dev-tools/cmd/asset/asset.go -license ASL2 -pkg include -in fields.yml -out include/fields.go mybeat_name
if [ -d /root/go/src/github.com/73986194/mybeat_name/_meta/kibana ]; then \
cp -pr /root/go/src/github.com/73986194/mybeat_name/_meta/kibana/* /root/go/src/github.com/73986194/mybeat_name/_meta/kibana.generated ; \
fi
Running dependency: github.com/elastic/beats/v7/dev-tools/mage/target/build.CrossBuildGoDaemon
exec: docker info -f {{ json .}}
Running dependency: github.com/elastic/beats/v7/dev-tools/mage/target/build.CrossBuild
Running dependency: github.com/elastic/beats/v7/dev-tools/mage.CrossBuild.func1
exec: go mod download
Running dependency: github.com/elastic/beats/v7/dev-tools/mage.buildMage
exec: mage -f -goos=linux -goarch=amd64 -compile build/mage-linux-amd64
crossBuild: Platform list = [{linux/386 cgo|xbuild|default} {linux/amd64 cgo|xbuild|default} {linux/arm64 cgo|xbuild|default}]
Max parallel jobs = 2
Parallel job waited 7.1µs before starting.
>> buildGoDaemon: Building for linux/arm64
Parallel job waited 300ns before starting.
>> buildGoDaemon: Building for linux/386
crossBuild: Platform list = [{darwin/amd64 cgo|xbuild|default} {linux/386 cgo|xbuild|default} {linux/amd64 cgo|xbuild|default} {linux/arm64 cgo|xbuild|default} {windows/386 cgo|xbuild|default} {windows/amd64 xbuild|default|cgo}]
exec: docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v
/root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name -w /go/src/github.com/73986194/mybeat_name docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-arm --build-cmd build/mage-linux-amd64 buildGoDaemon -p linux/arm64
exec: docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v
/root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name-w /go/src/github.com/73986194/mybeat_namedocker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7 --build-cmd build/mage-linux-amd64 buildGoDaemon -p linux/386
>> Building using: cmd='build/mage-linux-amd64 buildGoDaemon', env=[CC=gcc, CXX=g++, GOARCH=386, GOARM=, GOOS=linux, PLATFORM_ID=linux-386]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/386: exit status 127
failed building for linux/386: exit status 127
>> Building using: cmd='build/mage-linux-amd64 buildGoDaemon', env=[CC=aarch64-linux-gnu-gcc, CXX=aarch64-linux-gnu-g++, GOARCH=arm64, GOARM=, GOOS=linux, PLATFORM_ID=linux-arm64]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/arm64: exit status 127
failed building for linux/arm64: exit status 127
Parallel job waited 2.8628761s before starting.
>> buildGoDaemon: Building for linux/amd64
exec: docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v
/root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name-w /go/src/github.com/73986194/mybeat_namedocker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7 --build-cmd build/mage-linux-amd64 buildGoDaemon -p linux/amd64
Parallel job waited 2.8834477s before starting.
>> golangCrossBuild: Building for windows/amd64
exec: docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v
/root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name-w /go/src/github.com/73986194/mybeat_namedocker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main --build-cmd build/mage-linux-amd64 golangCrossBuild -p windows/amd64
>> Building using: cmd='build/mage-linux-amd64 buildGoDaemon', env=[CC=gcc, CXX=g++, GOARCH=amd64, GOARM=, GOOS=linux, PLATFORM_ID=linux-amd64]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/amd64: exit status 127
failed building for linux/amd64: exit status 127
>> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=x86_64-w64-mingw32-gcc, CXX=x86_64-w64-mingw32-g++, GOARCH=amd64, GOARM=, GOOS=windows, PLATFORM_ID=windows-amd64]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for windows/amd64: exit status 127
failed building for windows/amd64: exit status 127
Parallel job waited 3.3012797s before starting.
>> golangCrossBuild: Building for darwin/amd64
exec: docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v
/root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name-w /go/src/github.com/73986194/mybeat_name docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-darwin --build-cmd build/mage-linux-amd64 golangCrossBuild -p darwin/amd64
Parallel job waited 3.3333425s before starting.
>> golangCrossBuild: Building for linux/386
exec: docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE=true --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v
/root/go/src/github.com/73986194/mybeat_name:/go/src/github.com/73986194/mybeat_name -w /go/src/github.com/73986194/mybeat_name docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7 --build-cmd build/mage-linux-amd64 golangCrossBuild -p linux/386
>> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=o64-clang, CXX=o64-clang++, GOARCH=amd64, GOARM=, GOOS=darwin, PLATFORM_ID=darwin-amd64]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for darwin/amd64: exit status 127
failed building for darwin/amd64: exit status 127
>> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=gcc, CXX=g++, GOARCH=386, GOARM=, GOOS=linux, PLATFORM_ID=linux-386]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/386: exit status 127
failed building for linux/386: exit status 127
Parallel job waited 3.7019805s before starting.
....
...