# Compiling certain version

**URL:** <https://discuss.elastic.co/t/compiling-certain-version/162832>\
**Category:** Beats\
**Created:** [January 3, 2019, 3:38pm UTC](https://discuss.elastic.co/t/compiling-certain-version/162832 "2019-01-03T15:38:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lifeofguenter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lifeofguenter/32/17384_2.png) [@lifeofguenter](https://discuss.elastic.co/u/lifeofguenter)\
**Post date:** [January 3, 2019, 3:38pm UTC](https://discuss.elastic.co/t/compiling-certain-version/162832/1 "2019-01-03T15:38:19Z")

</div>

I followed the following instructions to compile beats from source: [Building filebeat from source](https://discuss.elastic.co/t/building-filebeat-from-source/135559)

It works, but even though I downloaded 6.5.4, when outputting the version I get:

```
~/Tmp/beats-6.5.4/x-pack/functionbeat  ./functionbeat version
functionbeat version 7.0.0 (amd64), libbeat 7.0.0 [built 2019-01-03 15:31:34 +0000 UTC]

```

How can I compile a specific version?

---

<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:** [January 3, 2019, 5:08pm UTC](https://discuss.elastic.co/t/compiling-certain-version/162832/2 "2019-01-03T17:08:18Z")

</div>

It's might be an issue with your GOPATH and when building it's pulling in dependencies from elsewhere that you have checked out. Try building it in isolation.

```auto
# Dockerfile
FROM golang:1.10.6

RUN mkdir -p /go/src/github.com/elastic \
      && git clone https://github.com/elastic/beats.git /go/src/github.com/elastic/beats

WORKDIR /go/src/github.com/elastic/beats

ENV COMMIT v6.5.4

RUN git checkout $COMMIT

RUN cd x-pack/functionbeat \
      && make functionbeat \
      && ./functionbeat version

```

```auto
$ docker build .
...
 ---> Running in f80665e63454
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2019-01-03T17:00:45Z -X github.com/elastic/beats/libbeat/version.commit=bd8922f1c7e93d12b07e0b3f7d349e17107f7826"
functionbeat version 6.5.4 (amd64), libbeat 6.5.4 [bd8922f1c7e93d12b07e0b3f7d349e17107f7826 built 2019-01-03 17:00:45 +0000 UTC]

```

edit: The v6.5.4 tag has been fixed so I updated the example.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 4, 2019, 12:37am UTC](https://discuss.elastic.co/t/compiling-certain-version/162832/3 "2019-01-04T00:37:11Z")

</div>

Checking github we did tag the wrong commit hash in the 6.5 release branch to be 6.5.4 by accident. It is the same code, but only the version number has already been updated to 6.5.5 (as this .

We fixed the commit hash to match the official release build hash. Redownloading beats-6.5.4 source code from github should get you the correct sources.

But you should not get the 7.0.0 version being displayed. Can you share your output of `go env`?

Do you have another checkout of Beats in `$GOPATH/src/github.com/elastic/beats`?

---

<div class="post-metadata">

**Author:** ![lifeofguenter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lifeofguenter/32/17384_2.png) [@lifeofguenter](https://discuss.elastic.co/u/lifeofguenter)\
**Post date:** [January 4, 2019, 6:36am UTC](https://discuss.elastic.co/t/compiling-certain-version/162832/4 "2019-01-04T06:36:15Z")

</div>

Awesome thanks @andrewkroh - that was exactly it - which means the thread I was linking to is not correct. Would be helpful to have it in the projects README.md

@steffens that was the second issue I was encountering, thank you for the heads-up!

---

<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:** [February 1, 2019, 8:36am UTC](https://discuss.elastic.co/t/compiling-certain-version/162832/5 "2019-02-01T08:36:18Z")

</div>

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