Skip to content

Commit

Permalink
[Build] Make mage-linux-amd64 statically compiled. (elastic#20827) (e…
Browse files Browse the repository at this point in the history
…lastic#20837)

* [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 273ecae)
  • Loading branch information
ph authored Aug 31, 2020
1 parent 662e708 commit aa54f5e
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 @@ -94,3 +94,4 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
- Update Go version to 1.14.4. {pull}19753[19753]
- Update Go version to 1.14.7. {pull}20508[20508]
- Add packaging for docker image based on UBI minimal 8. {pull}20576[20576]
- 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 aa54f5e

Please sign in to comment.