Compiling filebeat for ppc64 h/w using go complier - issues

Hi, I'm attempting to compile filebeat from source using go compiler v1.13.8 as per this document: https://www.elastic.co/guide/en/beats/devguide/7.x/beats-contributing.html

However, when I run the make command - I see this error:

[xxxxxxxxxxxxxxxxxx]# make
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2020-02-17T22:17:09Z -X github.com/elastic/beats/libbeat/version.commit=6d0d0ae079e5cb1d4f224801ac6df926dfb1594c"
build github.com/elastic/beats/filebeat: cannot load 4d63.com/tz: open /opt/apps/go/src/4d63.com/tz: no such file or directory
make: *** [filebeat] Error 1

I understand the support on power h/w is very limited from elastic support, and so reaching out here for help.

Thanks!

Hello, thanks for reaching out about building filebeat. Are you trying to build filebeat for a Linux distribution on ppc64? If so what Linux distribution are you using? It's possible that you'll be able to build filebeat on a ppc64 system running Linux. I've seen similar posts where folks built beats on a RHEL 7 ppc64 system.

The error you included is interesting. The tz library is a dependency for beats. Do the following commands work on your ppc64 system?

go get -u 4d63.com/tz

go get -u https://github.com/leighmcculloch/go-tz

Thanks Michael, I tried to run the two commands (although second one didn't work as expected due to an error, and so had to git clone). But now, I see this error when ran the make command:

[xxxxxxxxxxxxxx filebeat]# make
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2020-02-18T15:03:30Z -X github.com/elastic/beats/libbeat/version.commit=6d0d0ae079e5cb1d4f224801ac6df926dfb1594c"
go: inconsistent vendoring in /opt/apps/go/src:
go.mod requires 4d63.com/embedfiles v1.0.0 but vendor/modules.txt does not include it.
run 'go mod tidy; go mod vendor' to sync
make: *** [filebeat] Error 1

I tried to run the command: go mod tidy; go mod vendor' to sync', but still erroring with same reason after the fact.

Also, this is RHEL 7 on ppc64 system.

Good catch on the the second go get command. It should have been this:

go get -u github.com/leighmcculloch/go-tz

Do you also get a similar error when running this command?

go get -u 4d63.com/tz

Are you building filebeat from master? I wonder if you'd run in the same issue on a branch that's been released? Would you mind trying something like this?

git checkout 7.6
cd filebeat
make

I was able to run the command "go get -u 4d63.com/tz". However, I see the same error ever after checking out filebeat v7.6:

[root@xxxxxxxx src]# go get -u 4d63.com/tz
[root@xxxxxxxxx filebeat]# git branch

Hello,

Thanks for trying to build filebeat in the 7.6 branch. I'm wondering if the GOPATH and other variables are getting set correctly? Could you please try the following?

go env

I've ran into issues with other make targets like make update and make docs if I did not have GOPATH set correctly.

[root@xxxxxxxxxx filebeat-7.5.1-linux-ppc64le]# cd -
/tmp
[root@dc2-svzdev06 tmp]# go env
GO111MODULE=""
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/opt/apps/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/apps/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/apps/go/pkg/tool/linux_ppc64le"
GCCGO="gccgo"
GOPPC64="power8"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build197465576=/tmp/go-build -gno-record-gcc-switches"

This is gopath that I used in the past, and it worked without errors for older version of filebeat/metricbeat (eg: v6.8 with older v of go). But once I upgraded go and working against latest beats - that is when I am noticing these errors.

Hello, thanks for the quick reply. That setting for GOPATH looks fine. I'll continue to brainstorm this issue.

Thanks.

I think the easiest approach would be to use the elastic/golang-crossbuild project to cross compile and package the binaries for ppc64le. Please let me know if you'd like me to post the details here.

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