golang在Windows环境编译Linux可执行文件

下载go和git并安装

  • https://golang.org/dl/
  • https://git-scm.com/downloads

下载gdrive的golang源码:https://github.com/gdrive-org/gdrive/archive/master.zip

编译

SET CGO_ENABLED=0

SET GOOS=linux

SET GOARCH=386

go get github.com/prasmussen/gdrive

go build -ldflags "-w -s"

如果编译64位版本,上面GOARCH改为amd64;如果编译arm版本上面GOARCH改为arm

参考:

https://github.com/gdrive-org/gdrive/issues/426

https://blog.csdn.net/panshiqu/article/details/53788067

评论

Popular Posts

常用的国内外延迟测速链接(generate_204)

随身WiFi折腾指南: 解锁、刷机与DIY

为什么你睡了11个小时仍然觉得疲累?

《爱的博弈》约翰·戈特曼 (John Gottman)

ICEcoder显示汉字出现乱码的处理

iPhone 4S用TFT屏 智能机主流屏幕详解

做微信朋友圈生意的30天实操总结

人际沟通黄金四大原则~真的挺不错的(转载)

神奇动物在哪里 Fantastic Beasts and Where to Find Them (2016)