APM Server build failing

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 -X 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

../../../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

../../../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

../../../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

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

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

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

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)

It seems your git tree is unclean.

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 -X 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

../../../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

../../../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

../../../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

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