# APM Server build failing

**URL:** <https://discuss.elastic.co/t/apm-server-build-failing/216170>\
**Category:** APM\
**Tags:** server\
**Created:** [January 23, 2020, 4:12am UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170 "2020-01-23T04:12:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishnu\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnu_singhal/32/52488_2.png) [@Vishnu\_Singhal](https://discuss.elastic.co/u/Vishnu_Singhal)\
**Post date:** [January 23, 2020, 4:12am UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170/1 "2020-01-23T04:12:33Z")

</div>

I'm unable to build APM server v7.4.2 code . Fails with following issues.  
**Kibana version** : NA

**Elasticsearch version** : NA

**APM Server version** : 7.4.2

**APM Agent language and version** : NA

**Browser version** : NA

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
github

**Fresh install or upgraded from other version?**  
Fresh Install

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
Unable to build APM Server Version v7.4.2

**Steps to reproduce** :  
1.git checkout apm-server code.  
2.checkout branch v7.4.2  
3. run command "make"

**Errors in browser console (if relevant)**:

**Provide logs and/or server output (if relevant)**:  
make  
go build -i -ldflags "-s -X [github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.buildTime=2020-01-23T04:07:38Z](http://github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.buildTime=2020-01-23T04:07:38Z) -X [github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.commit=1726aa000d8e1558879c9e9700966d1a2ce6d4d2](http://github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.commit=1726aa000d8e1558879c9e9700966d1a2ce6d4d2)"

# [github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm](http://github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm)

../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:34:2: esMinILMVersion redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:80:2  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:41:2: esFeaturesPath redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:72:19  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:43:2: esILMPath redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:74:14  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:45:2: esAliasPath redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:76:16  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:50:6: ESClientHandler redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:41:6  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:50:39: undefined: APIHandler  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:59:6: ESClient redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:47:6

# [github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype](http://github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype)

../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:38:6: Folders redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:37:33  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:41:10: Folders.func1 redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:40:10  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:45:10: Folders.func2 redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:44:10  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:48:9: Folders.func3 redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:47:9  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:60:6: makeUserFoldFns redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:59:68

# [github.com/elastic/apm-server/vendor/github.com/miekg/dns](http://github.com/elastic/apm-server/vendor/github.com/miekg/dns)

../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:10:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:13:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:16:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:22:18: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:26:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:29:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:32:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:35:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:38:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:41:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:41:17: too many errors  
\_beats/libbeat/scripts/Makefile:107: recipe for target 'apm-server' failed  
make: \*\*\* [apm-server] Error 2

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [January 23, 2020, 10:58am UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170/2 "2020-01-23T10:58:18Z")

</div>

I just checked out the same branch and can build without any errors. Could you try running `make clean update` before?

---

<div class="post-metadata">

**Author:** ![Vishnu\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnu_singhal/32/52488_2.png) [@Vishnu\_Singhal](https://discuss.elastic.co/u/Vishnu_Singhal)\
**Post date:** [January 23, 2020, 1:25pm UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170/3 "2020-01-23T13:25:52Z")

</div>

Even that failed with following logs

Step 15/19 : RUN make clean update  
---\> Running in 337c72811724  
Installing mage v1.8.0 from vendor dir.  
/root/.magefile cleaned

# [github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype](http://github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype)

vendor/github.com/elastic/go-structform/gotype/opts.go:38:6: Folders redeclared in this block  
previous declaration at vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:37:33  
vendor/github.com/elastic/go-structform/gotype/opts.go:41:10: Folders.func1 redeclared in this block  
previous declaration at vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:40:10  
vendor/github.com/elastic/go-structform/gotype/opts.go:45:10: Folders.func2 redeclared in this block  
previous declaration at vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:44:10  
vendor/github.com/elastic/go-structform/gotype/opts.go:48:9: Folders.func3 redeclared in this block  
previous declaration at vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:47:9  
vendor/github.com/elastic/go-structform/gotype/opts.go:60:6: makeUserFoldFns redeclared in this block  
previous declaration at vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:59:68  
Error: error compiling magefiles  
make: \*\*\* [\_beats/libbeat/scripts/Makefile:154: clean] Error 1  
The command '/bin/sh -c make clean update' returned a non-zero code: 2

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [January 24, 2020, 3:58am UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170/4 "2020-01-24T03:58:39Z")

</div>

In the error output, there's mention of files that don't exist in the v7.4.2 tag, like `vendor/github.com/elastic/go-structform/gotype/opts.go` (compare to [https://github.com/elastic/apm-server/tree/v7.4.2/vendor/github.com/elastic/go-structform/gotype](https://github.com/elastic/apm-server/tree/v7.4.2/vendor/github.com/elastic/go-structform/gotype))

It seems your git tree is unclean.

---

<div class="post-metadata">

**Author:** ![Vishnu\_Singhal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnu_singhal/32/52488_2.png) [@Vishnu\_Singhal](https://discuss.elastic.co/u/Vishnu_Singhal)\
**Post date:** [January 24, 2020, 2:29pm UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170/5 "2020-01-24T14:29:43Z")

</div>

I did clean git

git clean -f

than ran make command

go build -i -ldflags "-s -X [github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.buildTime=2020-01-24T14:28:48Z](http://github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.buildTime=2020-01-24T14:28:48Z) -X [github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.commit=1726aa000d8e1558879c9e9700966d1a2ce6d4d2](http://github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/version.commit=1726aa000d8e1558879c9e9700966d1a2ce6d4d2)"

# [github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm](http://github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm)

../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:34:2: esMinILMVersion redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:80:2  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:41:2: esFeaturesPath redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:72:19  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:43:2: esILMPath redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:74:14  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:45:2: esAliasPath redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:76:16  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:50:6: ESClientHandler redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:41:6  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:50:39: undefined: APIHandler  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go:59:6: ESClient redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/client\_handler.go:47:6

# [github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype](http://github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype)

../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:38:6: Folders redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:37:33  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:41:10: Folders.func1 redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:40:10  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:45:10: Folders.func2 redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:44:10  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:48:9: Folders.func3 redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:47:9  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/opts.go:60:6: makeUserFoldFns redeclared in this block  
previous declaration at ../../../go/src/github.com/elastic/apm-server/vendor/github.com/elastic/go-structform/gotype/fold\_opts.go:59:68

# [github.com/elastic/apm-server/vendor/github.com/miekg/dns](http://github.com/elastic/apm-server/vendor/github.com/miekg/dns)

../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:10:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:13:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:16:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:22:18: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:26:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:29:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:32:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:35:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:38:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:41:17: undefined: compressionLenHelper  
../../../go/src/github.com/elastic/apm-server/vendor/github.com/miekg/dns/zcompress.go:41:17: too many errors  
\_beats/libbeat/scripts/Makefile:107: recipe for target 'apm-server' failed  
make: \*\*\* [apm-server] Error 2

---

<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 14, 2020, 10:29am UTC](https://discuss.elastic.co/t/apm-server-build-failing/216170/6 "2020-02-14T10:29:45Z")

</div>

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