cross-native2: set CGO_CFLAGS, CGO_LDFLAGS
Cross compiling go programs with cross-native2 fails for armv7, riscv64 and armhf unless we use CGO_ENABLED=1 in the APKBUILD (see related aports issue).
Add --sysroot to CGO_CFLAGS, so cgo can find the includes and doesn't fail with:
go build -buildmode=pie -modcacherw -trimpath -buildvcs=false -ldflags "-s -w -X main.Version=2.6.1" -o mkinitfs ./cmd/mkinitfs
# runtime/cgo
_cgo_export.c:3:10: fatal error: stdlib.h: No such file or directory
Add it to LDFLAGS too for linking against libraries from the sysroot.
Related: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15809
Related: https://stackoverflow.com/a/38835938
Merge request reports
Activity
mentioned in merge request pmaports!6297 (merged)
added 1 commit
- 06bd8d98 - cross-native2: set CGO_CFLAGS, CGO_LDFLAGS (MR 2565)
Please register or sign in to reply