dsimib1625
dsimib1625
2015-06-15 13:23
浏览 77
已采纳

为Linux和Mac构建一个go二进制文件

This question already has an answer here:

How can I go build a project in a way that it works for both Mac and Linux (x86 and x64)? Is that even possible?

I searched and found some stuff, but cannot make them work (or maybe I just didn't understood them).

</div>

图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 在这里有答案:

  • 可以在OSX上交叉编译吗? 6个答案 < / li>

    如何以适用于Mac和Mac的方式去构建一个项目 Linux(x86和x64)?

    我搜索并找到了一些东西,但无法使它们正常工作(或者也许我只是不理解它们)。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dpno17028
    dpno17028 2015-06-15 15:04
    已采纳

    To build binaries for different platforms, I use GOX

    Gox is a simple, no-frills tool for Go cross compilation that behaves a lot like standard go build. Gox will parallelize builds for multiple platforms. Gox will also build the cross-compilation toolchain for you.

    You tell it which platforms you want to target, and one command will build a separate binary for each of them. One binary cannot target multiple systems though.

    To build for OSX (64 bit) and Linux (32 and 64 bit), you could use:

    gox -osarch="darwin/amd64 linux/386 linux/amd64"
    
    点赞 评论

相关推荐