From e0150c55fb936e6a102da1be9d115eda449ee920 Mon Sep 17 00:00:00 2001 From: Fae Charlton Date: Thu, 15 Jun 2023 16:59:17 -0400 Subject: [PATCH] Remove 32-bit architectures from build scripts and support code (#35789) * Remove 32-bit architectures from build scripts and support code * fix linter errors --- .ci/packaging.groovy | 2 -- Jenkinsfile | 2 -- dev-tools/mage/godaemon.go | 2 -- dev-tools/mage/pkg.go | 2 +- dev-tools/mage/pkgdeps.go | 1 - dev-tools/mage/platforms.go | 16 +++++++--------- docs/devguide/contributing.asciidoc | 3 +-- libbeat/scripts/Makefile | 2 +- packetbeat/scripts/mage/build.go | 7 ------- packetbeat/scripts/mage/pcap.go | 4 ---- x-pack/packetbeat/magefile.go | 7 +------ 11 files changed, 11 insertions(+), 37 deletions(-) diff --git a/.ci/packaging.groovy b/.ci/packaging.groovy index 6138d335ad9..7ba3d20b2cc 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -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 @@ -341,7 +340,6 @@ def linuxPlatforms() { //'linux/mips64', //'linux/s390x', 'windows/amd64', - 'windows/386', 'darwin/amd64', 'darwin/arm64' ].join(' ') diff --git a/Jenkinsfile b/Jenkinsfile index 1da726b38cd..d9192e1e1ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 @@ -427,7 +426,6 @@ def packagingLinux(Map args = [:]) { //'linux/mips64', //'linux/s390x', 'windows/amd64', - 'windows/386', 'darwin/amd64', 'darwin/arm64' ].join(' ') diff --git a/dev-tools/mage/godaemon.go b/dev-tools/mage/godaemon.go index b580bc3ed5e..c328703634b 100644 --- a/dev-tools/mage/godaemon.go +++ b/dev-tools/mage/godaemon.go @@ -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) diff --git a/dev-tools/mage/pkg.go b/dev-tools/mage/pkg.go index c9448e99ab2..53783b29553 100644 --- a/dev-tools/mage/pkg.go +++ b/dev-tools/mage/pkg.go @@ -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 diff --git a/dev-tools/mage/pkgdeps.go b/dev-tools/mage/pkgdeps.go index 3b459828770..74cd4c6049a 100644 --- a/dev-tools/mage/pkgdeps.go +++ b/dev-tools/mage/pkgdeps.go @@ -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"} diff --git a/dev-tools/mage/platforms.go b/dev-tools/mage/platforms.go index 68cddd247f2..f2e835f687c 100644 --- a/dev-tools/mage/platforms.go +++ b/dev-tools/mage/platforms.go @@ -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. @@ -32,7 +31,7 @@ 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}, @@ -40,7 +39,7 @@ var BuildPlatforms = BuildPlatformList{ {"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}, @@ -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}, } @@ -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) } } @@ -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, ", "))) } @@ -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() } diff --git a/docs/devguide/contributing.asciidoc b/docs/devguide/contributing.asciidoc index 284c7627e6d..fb9c23dab73 100644 --- a/docs/devguide/contributing.asciidoc +++ b/docs/devguide/contributing.asciidoc @@ -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. diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index 7a5cef960eb..100ccd3f013 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -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 diff --git a/packetbeat/scripts/mage/build.go b/packetbeat/scripts/mage/build.go index ad889396a2a..6077f9c4f6f 100644 --- a/packetbeat/scripts/mage/build.go +++ b/packetbeat/scripts/mage/build.go @@ -18,8 +18,6 @@ package mage import ( - "strings" - devtools "github.com/elastic/beats/v7/dev-tools/mage" ) @@ -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 }), ) diff --git a/packetbeat/scripts/mage/pcap.go b/packetbeat/scripts/mage/pcap.go index f1ed34177d8..aab41c3d8fe 100644 --- a/packetbeat/scripts/mage/pcap.go +++ b/packetbeat/scripts/mage/pcap.go @@ -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, @@ -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, @@ -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", } diff --git a/x-pack/packetbeat/magefile.go b/x-pack/packetbeat/magefile.go index f1b21148189..daee711156a 100644 --- a/x-pack/packetbeat/magefile.go +++ b/x-pack/packetbeat/magefile.go @@ -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") }