Cross compile metricbeat for FreeBSD

Trying to cross-compile metricbeat 6.4.0 for FreeBSD 11.1-amd64 via Debian-9.5.0-amd64, yet stuck at gosigar vomitting:

github.com/elastic/beats/vendor/github.com/elastic/gosigar

../vendor/github.com/elastic/gosigar/concrete_sigar.go:67:10: p.Get undefined (type HugeTLBPages has no field or method Get)
../vendor/github.com/elastic/gosigar/concrete_sigar.go:79:11: fd.Get undefined (type FDUsage has no field or method Get)
../vendor/github.com/elastic/gosigar/sigar_linux_common.go:95:4: undefined: parseCpuStat
../vendor/github.com/elastic/gosigar/sigar_linux_common.go:113:4: undefined: parseCpuStat
../vendor/github.com/elastic/gosigar/sigar_linux_common.go:131:18: undefined: getMountTableFileName

The steps being followed:

#wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz
#tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz
#export PATH=$PATH:/usr/local/go/bin
#apt-get install git gcc
#go get github.com/elastic/beats
#cd ~/go/src/github.com/elastic/beats/metricbeat
#git checkout "v6.4.0"
#go get github.com/elastic/gosigar
#GOARCH=amd64 GOOS=freebsd go build

What is missing ?

Doing a pure FreeBSD setup to build on results in:

../vendor/github.com/elastic/gosigar/sigar_freebsd.go:101:27 undefined: runtime

Build environment setup as follows:

#pkg install wget git
#wget https://dl.google.com/go/go1.11.freebsd-amd64.tar.gz
#tar -C /usr/local -xzf go1.11.freebsd-amd64.tar.gz
#export PATH=$PATH:/usr/local/go/bin
#go get github.com/elastic/beats
#cd ~/go/src/github.com/elastic/beats/metricbeat
#git checkout "v6.4.0"
#go get github.com/elastic/gosigar
#go build

Any help to get this binary build will be greatly appreciated. Thx

Hi @Peek :slight_smile:

I've just done a full clean install in an Ubuntu Docker image without problem so we can discard a problem in the procedure.

I have realized that HugeTLBPages isn't supported in FreeBSD at the moment as you can see here https://github.com/elastic/gosigar

My only suggestion, right now, is to try to build it without the system and windows, which are the Metricbeat modules that uses gosigar but at the same time, libbeat library also uses it so I'm not sure if it will work.

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