# How to compile beats

**URL:** <https://discuss.elastic.co/t/how-to-compile-beats/37805>\
**Category:** Beats\
**Created:** [December 22, 2015, 11:00pm UTC](https://discuss.elastic.co/t/how-to-compile-beats/37805 "2015-12-22T23:00:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cory\_Marsh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cory_marsh/32/6793_2.png) [@Cory\_Marsh](https://discuss.elastic.co/u/Cory_Marsh)\
**Post date:** [December 22, 2015, 11:00pm UTC](https://discuss.elastic.co/t/how-to-compile-beats/37805/1 "2015-12-22T23:00:02Z")

</div>

TL;DR: Is there a doc or wiki page on how to compile? I'm sure it's something simple and obvious, but I don't even know what to try or what to read at this point

So I have been struggling trying to get libbeat to compile. I am new to go programming so some of this might be obvious to people who have been developing go for a while. It seems like I'm supposed to copy the libbeats source code into my "src" directory in my go install(/usr/local/go)? Is that right?

That seems really messy. If I clone into a new directory (/code/security/beats), after I get docker 1.19 running, this is what make gives me:

/code/security/beats$ echo $GOPATH  
/code/security/beats  
/code/security/beats$ echo $GOROOT  
/usr/local/go  
/usr/local/go$ cat VERSION  
go1.5.2  
/code/security/beats$ uname -a  
Linux infosec3 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 x86\_64 x86\_64 x86\_64 GNU/Linux  
/code/security/beats)$ zsh --version  
zsh 5.0.2 (x86\_64-pc-linux-gnu)  
/code/security/beats$ git pull  
remote: Counting objects: 81, done.  
remote: Compressing objects: 100% (2/2), done.  
remote: Total 81 (delta 49), reused 49 (delta 49), pack-reused 30  
Unpacking objects: 100% (81/81), done.  
From [https://github.com/elastic/beats](https://github.com/elastic/beats)  
Updating 1873d72..e58f861  
Fast-forward  
/code/security/beats$ make  
....  
...  
make[2]: Entering directory `/code/security/beats/libbeat' go test -c -covermode=atomic -coverpkg ./... libbeat.go:4:2: cannot find package "github.com/elastic/beats/libbeat/beat" in any of: /usr/local/go/src/github.com/elastic/beats/libbeat/beat (from $GOROOT) /code/security/beats/src/github.com/elastic/beats/libbeat/beat (from $GOPATH) libbeat.go:5:2: cannot find package "github.com/elastic/beats/libbeat/mock" in any of: /usr/local/go/src/github.com/elastic/beats/libbeat/mock (from $GOROOT) /code/security/beats/src/github.com/elastic/beats/libbeat/mock (from $GOPATH) make[2]: *** [libbeat.test] Error 1 make[2]: Leaving directory`/code/security/beats/libbeat'

I read another post that seemed to indicate that libbeat needs to be copied into /usr/local/go/src/github.com/elastic/beats/libbeat/beat. Is that right? If so, which directory needs to be copied where and which make file should I be using or should I not even be using make ?

- Frustrated Cory

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [December 22, 2015, 11:55pm UTC](https://discuss.elastic.co/t/how-to-compile-beats/37805/2 "2015-12-22T23:55:31Z")

</div>

The [contributing guide](https://github.com/elastic/beats/blob/master/CONTRIBUTING.md#setting-up-your-dev-environment) should answer your questions.

If you have any questions after reading it, please ask.

---

<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:** [July 5, 2017, 9:57pm UTC](https://discuss.elastic.co/t/how-to-compile-beats/37805/3 "2017-07-05T21:57:18Z")

</div>


