feat: enable CGO cross-compilation using gythialy/golang-cross - #43
feat: enable CGO cross-compilation using gythialy/golang-cross#43sampras343 wants to merge 1 commit into
Conversation
PR Summary by QodoEnable CGO cross-compilation via gythialy/golang-cross (macOS + Windows)
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
==========================================
+ Coverage 74.47% 76.14% +1.67%
==========================================
Files 22 27 +5
Lines 2268 3215 +947
==========================================
+ Hits 1689 2448 +759
- Misses 305 402 +97
- Partials 274 365 +91
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review by Qodo
1.
|
13474d7 to
ca47b1a
Compare
Enable CGO_ENABLED=1 across all build paths to support features requiring CGO. Install zig in the UBI9 go-toolset cross-platform build stage as a C cross-compiler for macOS and Windows targets, keeping the base image on registry.redhat.io for EC compliance. Use zig-cc/zig-cxx wrapper scripts for macOS targets to filter out SDK-dependent linker flags (-lresolv, -framework) that zig cannot resolve without a macOS sysroot. Combined with -undefined dynamic_lookup to defer those symbols to runtime resolution. Use netgo and osusergo build tags for cross-compiled targets to minimize system library dependencies. Strip debug symbols (-s) for macOS targets to avoid dsymutil dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sachin Sampras M <sampras343@gmail.com>
ca47b1a to
617f400
Compare
Summary
CGO_ENABLED=1across all build paths (Dockerfile.rh,Dockerfile.tufcli-init,Build.mak) to support features requiring CGODockerfile.cli-stack.rh) from UBI9 go-toolset toghcr.io/gythialy/golang-cross:v1.26.4-0, which bundles osxcross (macOS) and mingw-w64 (Windows) cross-compiler toolchainsCC/CXXinBuild.mak:oa64-clang(darwin/arm64),o64-clang(darwin/amd64),x86_64-w64-mingw32-gcc(windows/amd64)GOFIPS140=v1.0.0,-tags=no_openssl,fips140=autogodebug unchangedTest plan
make buildsucceeds locally with CGO enableddocker build -f Dockerfile.rh .builds successfullydocker build -f Dockerfile.tufcli-init .builds successfullydocker build --target build-cross-platform -f Dockerfile.cli-stack.rh .pulls golang-cross and cross-compiles all 3 targets