A comprehensive guide demonstrating how to cross-compile mixed C and Go applications using cgo and Bazel build system. The tutorial covers setting up RISC-V GNU toolchain with glibc support, configuring Bazel toolchain constraints specifically for cgo cross-compilation, and addresses the critical detail of using Go-specific CPU constraints instead of standard Bazel constraints. The example shows compiling from x86_64 Linux to RISC-V Linux, with verification using QEMU emulation.

9m read timeFrom popovicu.com
Post cover image
Table of contents
Table of contentsCross-compiling CCross-compiling GoReminder on BazelGitHubPutting it all togetherVerificationConclusion

Sort: