From 6055a47c902939b9b9a0f73d3ce57636d105d36ad27893a32fb2c67a42bd9c7e Mon Sep 17 00:00:00 2001 From: Gabriel Bazzotti Date: Wed, 21 Jan 2026 08:58:51 -0300 Subject: [PATCH 1/5] fix(spec): export CGO=0 flag to fix build for s390x arch --- micro-editor.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/micro-editor.spec b/micro-editor.spec index ed84d49..3435bd1 100644 --- a/micro-editor.spec +++ b/micro-editor.spec @@ -53,6 +53,7 @@ tar -xf %{SOURCE1} %build export GOFLAGS="-mod=vendor" +export CGO=0 %ifnarch ppc64 ppc64le export GOFLAGS="${GOFLAGS} -buildmode=pie" -- 2.51.1 From 0da941821a9405204c50c38bcb02ae157e04883bb53932ea3f16c503beb53a36 Mon Sep 17 00:00:00 2001 From: Gabriel Bazzotti Date: Wed, 21 Jan 2026 09:37:33 -0300 Subject: [PATCH 2/5] fix(spec): remove -buildmode=pie from s390x arch --- micro-editor.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/micro-editor.spec b/micro-editor.spec index 3435bd1..3be531a 100644 --- a/micro-editor.spec +++ b/micro-editor.spec @@ -54,6 +54,9 @@ tar -xf %{SOURCE1} %build export GOFLAGS="-mod=vendor" export CGO=0 +%ifnarch ppc64 ppc64le s390x + export GOFLAGS="${GOFLAGS} -buildmode=pie" +%endif %ifnarch ppc64 ppc64le export GOFLAGS="${GOFLAGS} -buildmode=pie" -- 2.51.1 From bd9ca66e3b2399c846b2f798fabd2fd383d28f20eaed878e69edd042038e0c94 Mon Sep 17 00:00:00 2001 From: Gabriel Bazzotti Date: Wed, 21 Jan 2026 10:03:05 -0300 Subject: [PATCH 3/5] fix(spec): insert check for selecting system architecture --- micro-editor.spec | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/micro-editor.spec b/micro-editor.spec index 3be531a..a47de8a 100644 --- a/micro-editor.spec +++ b/micro-editor.spec @@ -54,13 +54,16 @@ tar -xf %{SOURCE1} %build export GOFLAGS="-mod=vendor" export CGO=0 -%ifnarch ppc64 ppc64le s390x - export GOFLAGS="${GOFLAGS} -buildmode=pie" -%endif -%ifnarch ppc64 ppc64le - export GOFLAGS="${GOFLAGS} -buildmode=pie" -%endif +case "$(uname -m)" in + s390x|ppc64|ppc64le) + echo "Building on $(uname -m): PIE disabled (requires CGO)" + ;; + *) + echo "Building on $(uname -m): Enabling PIE" + export GOFLAGS="$GOFLAGS -buildmode=pie" + ;; +esac export DATE="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%s)} --iso-8601)" export HASH="%{shortcommit}" -- 2.51.1 From e5ad7bf8e2b07752cfc9de1fba9b8590e7e9c95ed58a22c2badea87c3c9582f7 Mon Sep 17 00:00:00 2001 From: Gabriel Bazzotti Date: Wed, 21 Jan 2026 11:23:02 -0300 Subject: [PATCH 4/5] fix(spec): add remaining architectures for the disable PIE mode block --- micro-editor.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/micro-editor.spec b/micro-editor.spec index a47de8a..01d15ab 100644 --- a/micro-editor.spec +++ b/micro-editor.spec @@ -56,10 +56,16 @@ export GOFLAGS="-mod=vendor" export CGO=0 case "$(uname -m)" in - s390x|ppc64|ppc64le) + # Enabling PIE (Position Independent Executable) in go allows a binary to be loaded by the OS into a random memory address + # however certain CPU architectures do not support PIEs by default so we have to disable it to properly build on OBS + # We achieve this by disabling PIE in favor of CGO + + # Disable PIE for these architectures + s390x|ppc64|ppc64le|i386|i586|i686|riscv64|armv7l) echo "Building on $(uname -m): PIE disabled (requires CGO)" ;; *) + # Enable PIE for x86_64 and aarch64 echo "Building on $(uname -m): Enabling PIE" export GOFLAGS="$GOFLAGS -buildmode=pie" ;; -- 2.51.1 From 493acf5fadcc9ecf3a3a638f47c77b8e386c02363c4d0b30a519dbcccbef11ab Mon Sep 17 00:00:00 2001 From: Gabriel Bazzotti Date: Wed, 21 Jan 2026 11:44:35 -0300 Subject: [PATCH 5/5] fix(spec): add armv6l architecture to list of disabled PIE mode building --- micro-editor.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micro-editor.spec b/micro-editor.spec index 01d15ab..d363419 100644 --- a/micro-editor.spec +++ b/micro-editor.spec @@ -61,7 +61,7 @@ case "$(uname -m)" in # We achieve this by disabling PIE in favor of CGO # Disable PIE for these architectures - s390x|ppc64|ppc64le|i386|i586|i686|riscv64|armv7l) + s390x|ppc64|ppc64le|i386|i586|i686|riscv64|armv7l|armv6l) echo "Building on $(uname -m): PIE disabled (requires CGO)" ;; *) -- 2.51.1