Skip to content

Commit

Permalink
[Build] Make mage-linux-amd64 statically compiled. (elastic#20827)
Browse files Browse the repository at this point in the history
* [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 committed Aug 27, 2020
1 parent 7eed2ff commit 9aa3333
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ 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]
- 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 9aa3333

Please sign in to comment.