Using the same methods I've been using to compile Beats for Pi since v6, I can no longer compile beats.
GOARCH=arm
GOOS=linux
GO v1.13.10
I clone the repo, checkout the commit for the release (5e69e25), cd to the beat I want (eg. metricbeat) and then make.
Makefile:84: warning: overriding recipe for target 'integration-tests'
../libbeat/scripts/Makefile:213: warning: ignoring old recipe for target 'integration-tests'
go build -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2020-05-14T19:02:30Z -X github.com/elastic/beats/libbeat/version.commit=5e69e25b920e3d93bec76a09a31da3ab35a55607"
# runtime/internal/sys
/usr/share/go/src/runtime/internal/sys/intrinsics_common.go:28:5: ntz8tab redeclared in this block
previous declaration at /usr/share/go/src/runtime/internal/sys/intrinsics.go:58:5
/usr/share/go/src/runtime/internal/sys/intrinsics_common.go:108:7: deBruijn64 redeclared in this block
previous declaration at /usr/share/go/src/runtime/internal/sys/intrinsics.go:11:20
make: *** [../libbeat/scripts/Makefile:133: metricbeat] Error 2
On my macbook where I have Go and Docker, I use this to build for armv7.
# Make sure $GOPATH/bin is on PATH
export PATH=$PATH:"$(go env GOPATH)"
cd metricbeat
git checkout v7.7.0
make mage
PLATFORMS='+all linux/armv7' mage -v package
The packages are in build/distributions. I install the .deb on my rpi.
ls -la build/distributions/
total 146968
drwxr-xr-x 8 akroh staff 256 May 15 11:51 .
drwxr-xr-x 10 akroh staff 320 May 15 11:50 ..
-rw-r--r--@ 1 akroh staff 24356032 May 15 11:51 metricbeat-oss-7.7.0-armhf.deb
-rw-r--r-- 1 akroh staff 160 May 15 11:51 metricbeat-oss-7.7.0-armhf.deb.sha512
-rw-r--r-- 1 akroh staff 24141686 May 15 11:51 metricbeat-oss-7.7.0-armhfp.rpm
-rw-r--r-- 1 akroh staff 161 May 15 11:51 metricbeat-oss-7.7.0-armhfp.rpm.sha512
-rw-r--r-- 1 akroh staff 24656644 May 15 11:50 metricbeat-oss-7.7.0-linux-armv7.tar.gz
-rw-r--r-- 1 akroh staff 169 May 15 11:50 metricbeat-oss-7.7.0-linux-armv7.tar.gz.sha512
Thanks! That at least got me started in the right direction i.e. forget trying to keep compiling these things on a Pi 4 and instead just cross-compile on my Mac.
GOOS=linux GOARCH=arm make
Works fine for everything except Packetbeat:
go build -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2020-05-19T20:13:05Z -X github.com/elastic/beats/libbeat/version.commit=d57bcf8684602e15000d65b75afcd110e2b12b59"
sniffer/afpacket_linux.go:26:2: build constraints exclude all Go files in .../src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/afpacket
make: *** [packetbeat] Error 1
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.