Go version

go1.25.1 X:nodwarf5 linux/amd64/clang/musl

Output of go env in your module/workspace:

WORK=/tmp/go-build3193581676
AR='llvm-ar'
CC='clang-20'
CGO_CFLAGS='-march=native -mtune=native -O3 -pipe -fopenmp -pthread -fno-plt -fomit-frame-pointer -fPIC -D_FORTIFY_SOURCE=2 -fopenmp-extensions -flto=thin -ffat-lto-objects'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-march=native -mtune=native -O3 -pipe -fopenmp -pthread -fno-plt -fomit-frame-pointer -fPIC -D_FORTIFY_SOURCE=2 -fopenmp-extensions -flto=thin -ffat-lto-objects'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-Wl,-O3,--sort-common,--as-needed,-z,noexecstack,-z,pack-relative-relocs,-z,relro,-z,now,--undefined-version -flto=thin -Wl,--gc-sections -fuse-ld=lld -march=native -mtune=native -O3 -pipe -fopenmp -pthread -fno-plt -fomit-frame-pointer -fPIC -D_FORTIFY_SOURCE=2 -fopenmp-extensions -ffat-lto-objects'
CXX='clang++-20'
GCCGO='gccgo'
GO111MODULE='on'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/root/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS='-buildmode=pie -buildvcs=false -modcacherw -v -x -p=1'
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3193581676=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/var/tmp/portage/app-containers/podman-5.5.2/work/podman-5.5.2/go.mod'
GOMODCACHE='/var/tmp/portage/app-containers/podman-5.5.2/work/go-mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.1 X:nodwarf5'
GOWORK=''
PKG_CONFIG='x86_64-pc-linux-musl-pkg-config'

What did you do?

Hello! Today I tried to compile Podman on my machine but encountered an error with it just exiting with error code 1. I went to check the logs to see what went wrong and saw the error “make: *** [Makefile:376: bin/podman] Error 1.” I looked at the Makefile at that location and saw the following build command:

bin/podman: $(SOURCES) go.mod go.sum
ifeq (,$(findstring systemd,$(BUILDTAGS)))
        @echo "Podman is being compiled without the systemd build tag. \
                Install libsystemd on Ubuntu or systemd-devel on rpm based \
                distro for journald support."
endif
        $(GOCMD) build \
                $(BUILDFLAGS) \
                $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
                -tags "$(BUILDTAGS)" \
                -o $@ ./cmd/podman
        test -z "${SELINUXOPT}" || chcon -t container_runtime_exec_t $@

And here’s the relevant build log output:

Podman is being compiled without the systemd build tag.         Install libsystemd on Ubuntu or systemd-devel on rpm based      distro for journald support.
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
        -v -work -x \
        -ldflags ' -X github.com/containers/podman/v5/libpod/define.buildInfo=1759585793 -X "github.com/containers/podman/v5/libpod/define.buildOrigin=Gentoo Portage" -X github.com/containers/podman/v5/libpod/config.additionalHelperBinariesDir= ' \
        -tags "    libsubid  seccomp" \
        -o bin/podman ./cmd/podman
WORK=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709

I tried to find the line where the error occurred but ended up with the following last lines:

packagefile strings=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b067/_pkg_.a
packagefile syscall=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b041/_pkg_.a
EOF
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/b1096/_pkg_.a -trimpath "$WORK/b1096=>" -p [github.com/coreos/go-systemd/v22/activation](https://github.com/coreos/go-systemd/v22/activation) -lang=go1.12 -complete -installsuffix shared -buildid i7G2aJ-g04FFPqU2v5o>
go tool buildid -w $WORK/b1096/_pkg_.a # internal
cp $WORK/b1096/_pkg_.a /var/tmp/portage/app-containers/podman-5.5.2/temp/go-build/35/353ad937b8673659f8bf811d5ec89ff1b1a398a31e946ac86e21c7af4681266b-d # internal
[github.com/containers/podman/v5/pkg/terminal](https://github.com/containers/podman/v5/pkg/terminal)
mkdir -p $WORK/b1099/
echo '# import config' > $WORK/b1099/importcfg # internal
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/b1099/_pkg_.a -trimpath "$WORK/b1099=>" -p [github.com/containers/podman/v5/pkg/terminal](https://github.com/containers/podman/v5/pkg/terminal) -lang=go1.23 -complete -installsuffix shared -buildid MB2_APaQNMVtJEPDsO>
go tool buildid -w $WORK/b1099/_pkg_.a # internal
cp $WORK/b1099/_pkg_.a /var/tmp/portage/app-containers/podman-5.5.2/temp/go-build/dd/dd5b946f39696cbda35bb788c7a48a0dc40e35703df7f0811f856b7eefc531f2-d # internal
log/syslog
mkdir -p $WORK/b1101/
cat >/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b1101/importcfg << 'EOF' # internal
# import config
packagefile errors=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b003/_pkg_.a
packagefile fmt=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b056/_pkg_.a
packagefile log=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b197/_pkg_.a
packagefile net=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b079/_pkg_.a
packagefile os=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b059/_pkg_.a
packagefile strings=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b067/_pkg_.a
packagefile sync=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b033/_pkg_.a
packagefile time=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b037/_pkg_.a
EOF
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/b1101/_pkg_.a -trimpath "$WORK/b1101=>" -p log/syslog -lang=go1.25 -std -complete -installsuffix shared -buildid VSFtIHOXZs99cn4AOggk/VSFtIHOXZs99cn4AOggk -gove>
go tool buildid -w $WORK/b1101/_pkg_.a # internal
cp $WORK/b1101/_pkg_.a /var/tmp/portage/app-containers/podman-5.5.2/temp/go-build/d7/d7a39fcd416e4aa3f0dea1c7953b424f546af6043f35c1412062b12f05cd45b1-d # internal
[github.com/sirupsen/logrus/hooks/syslog](https://github.com/sirupsen/logrus/hooks/syslog)
mkdir -p $WORK/b1100/
cat >/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b1100/importcfg << 'EOF' # internal
# import config
packagefile fmt=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b056/_pkg_.a
packagefile [github.com/sirupsen/logrus=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b196/_pkg_.a](https://github.com/sirupsen/logrus=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b196/_pkg_.a)
packagefile log/syslog=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b1101/_pkg_.a
packagefile os=/var/tmp/portage/app-containers/podman-5.5.2/temp/go-build3069367709/b059/_pkg_.a
EOF
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/b1100/_pkg_.a -trimpath "$WORK/b1100=>" -p [github.com/sirupsen/logrus/hooks/syslog](https://github.com/sirupsen/logrus/hooks/syslog) -lang=go1.13 -complete -installsuffix shared -buildid oRG7fLsoYxzYpTzhXEJs/oR>
go tool buildid -w $WORK/b1100/_pkg_.a # internal
cp $WORK/b1100/_pkg_.a /var/tmp/portage/app-containers/podman-5.5.2/temp/go-build/4e/4efcc7586505932d0322d274bb3d783f5ddbc2606e734ccd34d47a68a1bb596f-d # internal
make: *** [Makefile:376: bin/podman] Error 1

After that, I limited the number of build threads to 1 and created a wrapper script around Go.

strace -f -o "$(date +%Y-%m-%d_%H-%M-%S)-$(printf "%04d" $((RANDOM % 10000)))-strace_output.txt" /usr/bin/go "$@"

After that, I obtained several strace files, with 7 having an exit code of 0 and 1 with an exit code of 1.

build.log

strace_output.tar.gz

Comment From: seankhliao

This looks like a gentoo build rather than something you invoked yourself. Does it happen if you remove gentoo from the equation (go from upstream, podman from upstream)? If not, then it should be filed towards the gentoo package.

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: based-us3r

This looks like a gentoo build rather than something you invoked yourself. Does it happen if you remove gentoo from the equation (go from upstream, podman from upstream)? If not, then it should be filed towards the gentoo package.

Yes, this behavior persists even after the manual build using:

git clone https://github.com/containers/podman --depth=1
cd podman
make -j1 -l1 'BUILDFLAGS=-v -work -x' GOMD2MAN=go-md2man EXTRA_BUILDTAGS=seccomp SELINUXOPT= all

And the result is the same. However, for some reason, using:

make -j1 -l1 'BUILDFLAGS=-v -work -x' GOMD2MAN=go-md2man EXTRA_BUILDTAGS=seccomp SELINUXOPT= all

returns exit code 1, while compiling directly with the command executed by make:

CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -work -x -ldflags ' -X github.com/containers/podman/v5/libpod/define.buildInfo=1759585793 -X "github.com/containers/podman/v5/libpod/define.buildOrigin=Gentoo Portage" -X github.com/containers/podman/v5/libpod/config._installPrefix=/usr -X github.com/containers/podman/v5/libpod/config._etcDir=/etc -X github.com/containers/podman/v5/pkg/systemd/quadlet._binDir=/usr/bin -X github.com/containers/common/pkg/config.additionalHelperBinariesDir= '   -tags "    libsubid  seccomp"   -o bin/podman ./cmd/podman

does not return exit code 1, even though the error definitely originates from Go, as this exit code is detected by strace when running Go.

Comment From: based-us3r

I also made a patch:

--- a/src/os/proc.go
+++ b/src/os/proc.go
@@ -60,7 +60,7 @@ func Getgroups() ([]int, error) {
 //
 // For portability, the status code should be in the range [0, 125].
 func Exit(code int) {
-       if code == 0 && testlog.PanicOnExit0() {
+       if (code == 0 && testlog.PanicOnExit0()) || code == 1 {
                // We were told to panic on calls to os.Exit(0).
                // This is used to fail tests that make an early
                // unexpected call to os.Exit(0).

Which resulted in:

panic: unexpected call to os.Exit(0) during test

goroutine 1 [running]:
os.Exit(0x1)
        os/proc.go:67 +0x5e
cmd/go/internal/base.Exit()
        cmd/go/internal/base/base.go:134 +0x5b
main.main()
        cmd/go/main.go:221 +0xe90
make: *** [Makefile:466: bin/podman-testing] Error 2
cp $WORK/b481/_pkg_.a /var/tmp/portage/app-containers/podman-5.5.2/temp/go-build/d8/d85eb26cc33e68aa61e9585a833867357ac0a2d7fc1d5668386507840592151e-d # internal
panic: unexpected call to os.Exit(0) during test

goroutine 1 [running]:
os.Exit(0x1)
        os/proc.go:67 +0x5e
cmd/go/internal/base.Exit()
        cmd/go/internal/base/base.go:134 +0x5b
main.main()
        cmd/go/main.go:221 +0xe90
cp $WORK/b483/_pkg_.a /var/tmp/portage/app-containers/podman-5.5.2/temp/go-build/d8/d85eb26cc33e68aa61e9585a833867357ac0a2d7fc1d5668386507840592151e-d # internal
make: *** [Makefile:392: bin/podman-remote] Error 2
panic: unexpected call to os.Exit(0) during test

goroutine 1 [running]:
os.Exit(0x1)
        os/proc.go:67 +0x5e
cmd/go/internal/base.Exit()
        cmd/go/internal/base/base.go:134 +0x5b
main.main()
        cmd/go/main.go:221 +0xe90
make: *** [Makefile:376: bin/podman] Error 2

Looking at the code, this seems very much like an error code 1 is being set somewhere, but base.Exit() is not being called at the same time?

Comment From: based-us3r

It turned out that errors still occur during compilation, but the compilation did not stop after them, so they simply got lost. It would be better if Go stopped the compilation right after the first error.

Additionally, an error occurs in code that can be attributed to misbehavior in cgo. In musl, the declaration of stderr looks like this:

extern FILE *const stderr;

But for C.stderr, the following code is generated:

CGO_NO_SANITIZE_THREAD
void
_cgo_8f3170700658_Cmacro_stderr(void *v)
{
        struct {
                FILE* const r;
        } __attribute__((__packed__)) *_cgo_a = v;
        char *_cgo_stktop = _cgo_topofstack();
        __typeof__(_cgo_a->r) _cgo_r;
        _cgo_tsan_acquire();
        _cgo_r = stderr;
        _cgo_tsan_release();
        _cgo_a = (void*)((char*)_cgo_a + (_cgo_topofstack() - _cgo_stktop));
        _cgo_a->r = _cgo_r;
        _cgo_msan_write(&_cgo_a->r, sizeof(_cgo_a->r));
}

And it triggers an error related to the redefinition of the constant reference _cgo_a->r:

cgo-gcc-prolog:85:9: error: cannot assign to variable '_cgo_r' with const-qualified type 'typeof (_cgo_a->r)' (aka 'struct _IO_FILE *const')
cgo-gcc-prolog:88:12: error: cannot assign to non-static data member 'r' with const-qualified type 'FILE *const' (aka 'struct _IO_FILE *const')