Silent compilation failure and SYSCALL miss in kernel version 5.4.x and golang-1.20.4 #60064
Labels
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Background:
Under Linux kernel version 5.4.x, there is a silent compilation failure, and no error is reported in the log. After investigation and retry, it was found that under the combination of kenel 5.4.X+golang 1.20.4+our backend system code, there will be silent errors and system call errors. This issue can be reliably reproduced.
OS Env:
Linux 907cd202b23f 5.4.119-1-tlinux4-0010.2(base on 5.4.X) #1 SMP Fri Nov 4 17:13:35 CST 2022 x86_64 x86_64 x86_64 GNU/Linux
go env:
[root@907cd202b23f ~/go/src/odp-admin-backend]# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="git.code.oa.com,github.com,xorm.io,launchpad.net,git.woa.com"
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://goproxy.woa.com,direct"
GOROOT="/opt/go"
GOSUMDB="sum.woa.com+643d7a06+Ac5f5VOC4N8NUXdmhbm8pZSXIWfhek5JSmWdWrq7pLX4"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/root/go/src/odp-admin-backend/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1301571221=/tmp/go-build -gno-record-gcc-switches"
Compilation command:
export GIT_TERMINAL_PROMPT=1
export GOPROXY="https://goproxy.woa.com,direct"
export GOSUMDB="sum.woa.com+643d7a06+Ac5f5VOC4N8NUXdmhbm8pZSXIWfhek5JSmWdWrq7pLX4"
export GOINSECURE=git.code.oa.com,github.com,xorm.io,launchpad.net,git.woa.com
export GOPRIVATE=""
#go clean --modcache
go mod tidy -compat=1.20
go mod vendor
yum install -y gpgme-devel
yum install -y device-mapper-devel.x86_64
yum install -y libassuan-devel.x86_64
yum install -y btrfs-progs-devel
CGO_ENABLED=1 GOARCH=amd64 GOOS=linux CGO_CFLAGS="" CGO_LDFLAGS="-L/usr/lib64 -lgpgme" go build -v -o bin/main cmd/server/main.go
Error situation :
On the first execution of the above compilation command, there was a silent error and the compilation exited without any error logs, which caused complete confusion about the situation. It was initially thought that there was a problem with the CI/CD system. The screenshot is as follows:
Then, when directly executing the command "CGO_ENABLED=1 GOARCH=amd64 GOOS=linux CGO_CFLAGS="" CGO_LDFLAGS="-L/usr/lib64 -lgpgme" go build -v -o bin/main cmd/server/main.go" for recompilation, an error was finally reported.
error message is
github.com/containers/storage/pkg/unshare
unshare.c: In function 'copy_self_proc_exe':
unshare.c:236:17: error: 'SYS_memfd_create' undeclared (first use in this function)
mmfd = syscall(SYS_memfd_create, exename, (long) MFD_ALLOW_SEALING | MFD_CLOEXEC);
^
unshare.c:236:17: note: each undeclared identifier is reported only once for each function it appears in
Probable cause:
The kernel 5.4.x may have reduced the SYS_memfd_create system call, which caused the compilation to fail. However, the first silent error may be due to a bug.
Thanks for your help :)
The text was updated successfully, but these errors were encountered: