Skip to content

Commit

Permalink
Remove 32-bit architectures from build scripts and support code (#35789)
Browse files Browse the repository at this point in the history
* Remove 32-bit architectures from build scripts and support code

* fix linter errors
  • Loading branch information
faec authored Jun 15, 2023
1 parent 27b1799 commit e0150c5
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 37 deletions.
2 changes: 0 additions & 2 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ def linuxPlatforms() {
return [
'+all',
'linux/amd64',
'linux/386',
'linux/arm64',
// armv7 packaging isn't working, and we don't currently
// need it for release. Do not re-enable it without
Expand All @@ -341,7 +340,6 @@ def linuxPlatforms() {
//'linux/mips64',
//'linux/s390x',
'windows/amd64',
'windows/386',
'darwin/amd64',
'darwin/arm64'
].join(' ')
Expand Down
2 changes: 0 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ def packagingArm(Map args = [:]) {
def packagingLinux(Map args = [:]) {
def PLATFORMS = [ '+all',
'linux/amd64',
'linux/386',
'linux/arm64',
// armv7 packaging isn't working, and we don't currently
// need it for release. Do not re-enable it without
Expand All @@ -427,7 +426,6 @@ def packagingLinux(Map args = [:]) {
//'linux/mips64',
//'linux/s390x',
'windows/amd64',
'windows/386',
'darwin/amd64',
'darwin/arm64'
].join(' ')
Expand Down
2 changes: 0 additions & 2 deletions dev-tools/mage/godaemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ func BuildGoDaemon() error {
switch Platform.Name {
case "linux/amd64":
compileCmd = append(compileCmd, "-m64")
case "linux/386":
compileCmd = append(compileCmd, "-m32")
}

defer DockerChown(output)
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/mage/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func TestPackages(options ...TestPackagesOption) error {
// glibc 2.17.
func TestLinuxForCentosGLIBC() error {
switch Platform.Name {
case "linux/amd64", "linux/386":
case "linux/amd64":
return TestBinaryGLIBCVersion(filepath.Join("build/golang-crossbuild", BeatName+"-linux-"+Platform.GOARCH), "2.17")
default:
return nil
Expand Down
1 change: 0 additions & 1 deletion dev-tools/mage/pkgdeps.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type PackageDependency struct {
}

var (
Linux386 = PlatformDescription{Name: "linux/386", Arch: "i386", DefaultTag: "i386"}
LinuxAMD64 = PlatformDescription{Name: "linux/amd64", Arch: "", DefaultTag: ""} // builders run on amd64 platform
LinuxARM64 = PlatformDescription{Name: "linux/arm64", Arch: "arm64", DefaultTag: "arm64"}
LinuxARM5 = PlatformDescription{Name: "linux/arm5", Arch: "armel", DefaultTag: "armel"}
Expand Down
16 changes: 7 additions & 9 deletions dev-tools/mage/platforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
package mage

import (
"fmt"
"sort"
"strings"

"github.com/pkg/errors"
)

// BuildPlatforms is a list of GOOS/GOARCH pairs supported by Go.
Expand All @@ -32,15 +31,15 @@ var BuildPlatforms = BuildPlatformList{
{"android/amd64", CGOSupported},
{"android/arm", CGOSupported},
{"android/arm64", CGOSupported},
{"darwin/386", CGOSupported | CrossBuildSupported},
{"darwin/386", 0},
{"darwin/amd64", CGOSupported | CrossBuildSupported | Default},
{"darwin/arm", CGOSupported},
{"darwin/arm64", CGOSupported | CrossBuildSupported | Default},
{"dragonfly/amd64", CGOSupported},
{"freebsd/386", CGOSupported},
{"freebsd/amd64", CGOSupported},
{"freebsd/arm", 0},
{"linux/386", CGOSupported | CrossBuildSupported | Default},
{"linux/386", 0},
{"linux/amd64", CGOSupported | CrossBuildSupported | Default},
{"linux/armv5", CGOSupported | CrossBuildSupported},
{"linux/armv6", CGOSupported | CrossBuildSupported},
Expand All @@ -66,7 +65,7 @@ var BuildPlatforms = BuildPlatformList{
{"plan9/amd64", 0},
{"plan9/arm", 0},
{"solaris/amd64", CGOSupported},
{"windows/386", CGOSupported | CrossBuildSupported | Default},
{"windows/386", 0},
{"windows/amd64", CGOSupported | CrossBuildSupported | Default},
}

Expand Down Expand Up @@ -317,7 +316,7 @@ func newPlatformExpression(expr string) (*platformExpression, error) {
}

if !valid {
return nil, errors.Errorf("invalid platform in expression: %v", name)
return nil, fmt.Errorf("invalid platform in expression: %v", name)
}
}

Expand Down Expand Up @@ -413,7 +412,7 @@ func (list BuildPlatformList) Filter(expr string) BuildPlatformList {
return list
}
if len(pe.Add) > 0 {
panic(errors.Errorf("adds (%v) cannot be used in filter expressions",
panic(fmt.Errorf("adds (%v) cannot be used in filter expressions",
strings.Join(pe.Add, ", ")))
}

Expand Down Expand Up @@ -449,8 +448,7 @@ func (list BuildPlatformList) Filter(expr string) BuildPlatformList {

// Merge creates a new list with the two list merged.
func (list BuildPlatformList) Merge(with BuildPlatformList) BuildPlatformList {
out := make(BuildPlatformList, 0, len(list)+len(with))
out = append(list, with...)
out := append(list, with...)
out = append(out, with...)
return out.deduplicate()
}
Expand Down
3 changes: 1 addition & 2 deletions docs/devguide/contributing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ sudo apt-get install python3-venv
Beats is built using the `make release` target. By default, make will select from a limited number of preset build targets:

- darwin/amd64
- linux/386
- darwin/arm64
- linux/amd64
- windows/386
- windows/amd64

You can change build targets using the `PLATFORMS` environment variable. Targets set with the `PLATFORMS` variable can either be a GOOS value, or a GOOS/arch pair.
Expand Down
2 changes: 1 addition & 1 deletion libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SYSTEM_TESTS?=false ## @testing if true, "make test" and "make testsuite" run un
STRESS_TESTS?=false ## @testing if true, "make test" and "make testsuite" run also run the stress tests
STRESS_TEST_OPTIONS?=-timeout=20m -race -v
GOX_OS?=linux darwin windows freebsd netbsd openbsd ## @Building List of all OS to be supported by "make crosscompile".
GOX_OSARCH?=!darwin/arm !darwin/arm64 !darwin/386 ## @building Space separated list of GOOS/GOARCH pairs to build by "make crosscompile".
GOX_OSARCH?=!darwin/arm !darwin/arm64 ## @building Space separated list of GOOS/GOARCH pairs to build by "make crosscompile".
GOX_FLAGS?= ## @building Additional flags to append to the gox command used by "make crosscompile".
# XXX: Should be switched back to `snapshot` once the Elasticsearch
# snapshots are working. https://github.com/elastic/beats/pull/6416
Expand Down
7 changes: 0 additions & 7 deletions packetbeat/scripts/mage/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package mage

import (
"strings"

devtools "github.com/elastic/beats/v7/dev-tools/mage"
)

Expand All @@ -35,11 +33,6 @@ func CrossBuild() error {
if err != nil {
return "", err
}
if platform == "linux/386" {
// Use Debian 9 because the linux/386 build needs an older glibc
// to remain compatible with CentOS 7 (glibc 2.17).
image = strings.ReplaceAll(image, "main-debian10", "main-debian9")
}
return image, nil
}),
)
Expand Down
4 changes: 0 additions & 4 deletions packetbeat/scripts/mage/pcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const (
)

var libpcapLDFLAGS = map[string]string{
"linux/386": "-L/libpcap/libpcap-1.8.1-i386 -lpcap",
"linux/amd64": "-L/libpcap/libpcap-1.8.1-amd64 -lpcap",
"linux/arm64": linuxPcapLDFLAGS,
"linux/armv5": linuxPcapLDFLAGS,
Expand All @@ -68,11 +67,9 @@ var libpcapLDFLAGS = map[string]string{
"linux/s390x": linuxPcapLDFLAGS,
"darwin/amd64": "-lpcap",
"windows/amd64": "-L /libpcap/win/WpdPack/Lib/x64 -lwpcap",
"windows/386": "-L /libpcap/win/WpdPack/Lib -lwpcap",
}

var libpcapCFLAGS = map[string]string{
"linux/386": linuxPcapCFLAGS,
"linux/amd64": linuxPcapCFLAGS,
"linux/arm64": linuxPcapCFLAGS,
"linux/armv5": linuxPcapCFLAGS,
Expand All @@ -85,5 +82,4 @@ var libpcapCFLAGS = map[string]string{
"linux/ppc64le": linuxPcapCFLAGS,
"linux/s390x": linuxPcapCFLAGS,
"windows/amd64": "-I /libpcap/win/WpdPack/Include",
"windows/386": "-I /libpcap/win/WpdPack/Include",
}
7 changes: 1 addition & 6 deletions x-pack/packetbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,10 @@ func CrossBuild() error {
if err != nil {
return "", err
}
if platform == "linux/386" {
// Use Debian 9 because the linux/386 build needs an older glibc
// to remain compatible with CentOS 7 (glibc 2.17).
image = strings.ReplaceAll(image, "main-debian10", "main-debian9")
}
if os.Getenv("CI") != "true" && os.Getenv("NPCAP_LOCAL") != "true" {
return image, nil
}
if platform == "windows/amd64" || platform == "windows/386" {
if platform == "windows/amd64" {
image = strings.ReplaceAll(image, "beats-dev", "observability-ci") // Temporarily work around naming of npcap image.
image = strings.ReplaceAll(image, "main", "npcap-"+NpcapVersion+"-debian9")
}
Expand Down

0 comments on commit e0150c5

Please sign in to comment.