From c778598c4462a04901f1b26fd8ec909d58ee4b65 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 10 Aug 2022 18:43:52 -0700 Subject: [PATCH] [1.1] ci/gha: fix cross-386 job vs go 1.19 When golang 1.19 is used to build unit tests on 386, it fails like this: sudo -E PATH="$PATH" -- make GOARCH=386 CGO_ENABLED=1 localunittest <...> go test -timeout 3m -tags "seccomp" -v ./... <...> # github.com/opencontainers/runc/libcontainer/capabilities.test runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel runtime/cgo(.text): relocation target __stack_chk_fail_local not defined runtime/cgo(.text): relocation target __stack_chk_fail_local not defined The fix is to add CGO_CFLAGS=-fno-stack-protector. See also: - https://github.com/docker-library/golang/pull/426 - https://go.dev/issue/52919 - https://go.dev/issue/54313 - https://go-review.googlesource.com/c/go/+/421935 Cherry picked from commit 589a9d5082a05932d7848f2db1f2253b751ba453. Conflict in .github/workflows/test.yml due to missing commit dafcacb5225a0668c0. Signed-off-by: Kir Kolyshkin --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 306bb0db7dc..27e97041e21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,4 +126,4 @@ jobs: - name: unit test # cgo is disabled by default when cross-compiling - run: sudo -E PATH="$PATH" -- make GOARCH=386 CGO_ENABLED=1 localunittest + run: sudo -E PATH="$PATH" -- make GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS=-fno-stack-protector localunittest