Go入门笔记33-Go 交叉编译

linux交叉编译为arm程序

CGO_ENABLED=0 GOOS=linux GOARCH=arm  go build main.go

注意了,上传到arm环境时一定要用rz命令或者先压缩再上传,如果直接用xshell sftp上传的程序会有错误Segmentation fault,原因不明,c、c++程序没有这个问题。

posted @ 2021-08-30 13:30  zhaogaojian  阅读(68)  评论(0编辑  收藏  举报