# Cross compile metricbeat for FreeBSD

**URL:** <https://discuss.elastic.co/t/cross-compile-metricbeat-for-freebsd/148543>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 14, 2018, 1:55am UTC](https://discuss.elastic.co/t/cross-compile-metricbeat-for-freebsd/148543 "2018-09-14T01:55:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peek/32/35533_2.png) [@Peek](https://discuss.elastic.co/u/Peek)\
**Post date:** [September 14, 2018, 1:55am UTC](https://discuss.elastic.co/t/cross-compile-metricbeat-for-freebsd/148543/1 "2018-09-14T01:55:08Z")

</div>

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](http://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 ?

---

<div class="post-metadata">

**Author:** ![Peek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peek/32/35533_2.png) [@Peek](https://discuss.elastic.co/u/Peek)\
**Post date:** [September 14, 2018, 4:51am UTC](https://discuss.elastic.co/t/cross-compile-metricbeat-for-freebsd/148543/2 "2018-09-14T04:51:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [September 14, 2018, 4:27pm UTC](https://discuss.elastic.co/t/cross-compile-metricbeat-for-freebsd/148543/3 "2018-09-14T16:27:35Z")

</div>

Hi @Peek 🙂

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](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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 13, 2018, 10:14am UTC](https://discuss.elastic.co/t/cross-compile-metricbeat-for-freebsd/148543/5 "2018-10-13T10:14:41Z")

</div>

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