Cannot make filebeat for aarch64

I make the filebeat on a linux aarch machine.

My Environment:

$ go version
go version go1.11.2 linux/arm64

$ git rev-parse HEAD
79a6ff31aec8e371631661add2e52938f250ceba

I get make failing with the following error:

$ make
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2018-12-06T08:20:44Z -X github.com/elastic/beats/libbeat/version.commit=79a6ff31aec8e371631661add2e52938f250ceba"
# github.com/elastic/beats/libbeat/common/file
../libbeat/common/file/stderr_other.go:30:9: undefined: syscall.Dup2
make: *** [filebeat] Error 2

How can I make this?

This is weird. Looks like Dup2 is missing in the stdlib syscall package on arm. Can you try to replace syscall.Dup2 with unix.Dup2 (package x/sys/unix, it's vendored)?

I can make with the following change:

diff --git a/libbeat/common/file/stderr_other.go b/libbeat/common/file/stderr_other.go
index 99ad24c..2731322 100644
--- a/libbeat/common/file/stderr_other.go
+++ b/libbeat/common/file/stderr_other.go
@@ -21,11 +21,11 @@ package file

 import (
        "os"
-       "syscall"
+       "golang.org/x/sys/unix"
 )

 // RedirectStandardError causes all standard error output to be directed to the
 // given file.
 func RedirectStandardError(toFile *os.File) error {
-       return syscall.Dup2(int(toFile.Fd()), 2)
+       return unix.Dup2(int(toFile.Fd()), 2)
 }

Thank you!

Thanks for confirming. Github PR fixing compilation upstream: https://github.com/elastic/beats/pull/9493

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.