Cross compilation from amd64 based Jenkins Agent to arm64 based Golang Binary

Hi Team,

I’m seeking guidance on cross-compiling a Go application with CGO_ENABLED=1 for the ARM64 architecture.

We previously resolved the following runtime error in AWS Lambda by using an Amazon Linux 2 base image, installing the necessary libraries, and copying the required shared libraries manually:

/var/task/bootstrap: error while loading shared libraries: libpcsclite.so.1: cannot open shared object file
cp /usr/lib64/libpcsclite.so.1 ./lib/
cp /usr/lib64/libpcsclite.so.* ./lib/

Now, I need to build the binary for the ARM64 architecture from a Jenkins agent that runs on AMD64. Given that CGO_ENABLED=1 is required, I’m unsure which cross-compiler (CC) should be used to correctly target ARM64 in this context.

Any suggestions or best practices would be greatly appreciated.

Hello!
I have the same problem with facing same issue but no response from anyone and couldn’t find this topic troubleshooting in search engine.