golang 记录交叉编译sqlite的报错信息 go build -ldflags

go build -ldflags ‘-s -w --extldflags “-static -fpic”’ -o go-web main.go

[gos20230512]# CGO_ENABLED=1 
CC=aarch64-linux-gnu-gcc 
CXX=aarch64-linux-gnu-g++ 
GOOS=linux 
GOARCH=arm64 
go build -ldflags 
'-s -w --extldflags "-static -fpic"' 
-o go-web main.go
# runtime/cgo
_cgo_export.c:3:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.

command-line-arguments
/tmp/go-link-1199555067/000015.o: In function ‘unixDlOpen’:
/root/go/pkg/mod/github.com/mattn/[email protected]/sqlite3-binding.c:40175: warning: Using ‘dlopen’ in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-1199555067/000004.o: In function `_cgo_6cc2654a8ed3_C2func_getaddrinfo’:
/tmp/go-build/cgo-gcc-prolog:58: warning: Using ‘getaddrinfo’ in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

# command-line-arguments
/tmp/go-link-1199555067/000015.o: In function `unixDlOpen':
/root/go/pkg/mod/github.com/mattn/[email protected]/sqlite3-binding.c:40175: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-1199555067/000004.o: In function `_cgo_6cc2654a8ed3_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime.throw({0x97376c?, 0x0?})
/usr/lib/golang/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
/usr/lib/golang/src/runtime/signal_unix.go:802 +0x389

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x7fea80, 0xc000052bb8)
/usr/lib/golang/src/runtime/cgocall.go:157 +0x5c fp=0xc000052b90 sp=0xc000052b58 pc=0x40dbbc
crypto/internal/boring._Cfunc__goboringcrypto_DLOPEN_OPENSSL()
_cgo_gotypes.go:619 +0x49 fp=0xc000052bb8 sp=0xc000052b90 pc=0x5208e9
crypto/internal/boring.init.0()
/usr/lib/golang/src/crypto/internal/boring/boring.go:52 +0x45 fp=0xc000052bf0 sp=0xc000052bb8 pc=0x5283e5
runtime.doInit(0xfc7e80)
/usr/lib/golang/src/runtime/proc.go:6230 +0x126 fp=0xc000052d20 sp=0xc000052bf0 pc=0x44d866
runtime.doInit(0xfc6780)
/usr/lib/golang/src/runtime/proc.go:6207 +0x71 fp=0xc000052e50 sp=0xc000052d20 pc=0x44d7b1
runtime.doInit(0xfc9f80)
/usr/lib/golang/src/runtime/proc.go:6207 +0x71 fp=0xc000052f80 sp=0xc000052e50 pc=0x44d7b1
runtime.main()
/usr/lib/golang/src/runtime/proc.go:233 +0x1d3 fp=0xc000052fe0 sp=0xc000052f80 pc=0x4408f3
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x46d4a1

你可能感兴趣的:(golang,sqlite,golang,数据库)