I build a darwin-amd64 version of my program on linux-amd64, the cross-compiling command is:
GOOS=darwin GOARCH=amd64 GOBIN=/tmp go install <myprogram>
Before that I've prepared the darwin-amd64 tool-chain using:
sudo GOOS=darwin GOARCH=amd64 ./make.bash
However, after giving this darwin-amd64 version binary to my colleagues, they can't use it for login because login will send a HTTPS request, which will use CGO. Errmsg returned is:
x509: failed to load system roots and no roots provided
Any suggestions on how to fix this?
That looks like a certificate issue, as the one mentioned in "Building Docker Images for Static Go Binaries"
So you can check if that
/etc/ssl/certs/ca-certificates.crt
is there on your colleague's workstation.But this bug report suggests:
Another solution involves cross-compiling with "
export CGO_ENABLED=0
".The bug 8349 shows some progress too with more recent Go.