Skip to content

Commit

Permalink
Cherry-pick elastic#20827 to 7.9: [Build] Make mage-linux-amd64 stati…
Browse files Browse the repository at this point in the history
…cally compiled. (elastic#20838)

* [Build] Make mage-linux-amd64 statically compiled. (elastic#20827)

* [Build] Make mage-linux-amd64 statically compiled.

When I've upgraded my arch system, they have upgraded the libc library,
that libary is much newer than the library used in the crossbuild
docker images. This made building beats impossible because the
mage-linux-amd64 is compiled dynamically and used in all our docker
build.

This PR make the mage binary to be statically compiled so it doesn't
rely on any installed libraries.

(cherry picked from commit 777eece)

* changelog quirks
  • Loading branch information
ph committed Sep 2, 2020
1 parent 4aa5476 commit 5ce96fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
- Added SQL helper that can be used from any Metricbeat module {pull}18955[18955]
- Update Go version to 1.14.4. {pull}19753[19753]
- Update Go version to 1.14.7. {pull}20508[20508]
- Make the mage binary used by the build process in the docker container to be statically compiled. {pull}20827[20827]
2 changes: 1 addition & 1 deletion dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func CrossBuildXPack(options ...CrossBuildOption) error {
// values for Docker. It has the benefit of speeding up the build because the
// mage -compile is done only once rather than in each Docker container.
func buildMage() error {
return sh.Run("mage", "-f", "-goos=linux", "-goarch=amd64",
return sh.RunWith(map[string]string{"CGO_ENABLED": "0"}, "mage", "-f", "-goos=linux", "-goarch=amd64",
"-compile", CreateDir(filepath.Join("build", "mage-linux-amd64")))
}

Expand Down

0 comments on commit 5ce96fb

Please sign in to comment.