dtiu94034 2013-12-29 19:22 采纳率: 0%
浏览 454
已采纳

如何从Windows交叉编译到Linux?

I've installed Go 1.2 on a Windows machine, wrote up a dummy program and set the environment variables GOARCH and GOOS to "AMD64" and "linux" respectively.

When i issue the "go build" command, i receive an error:

go build runtime: linux/amd64 must be bootstrapped using make.bat

What does this mean?

  • 写回答

4条回答 默认 最新

  • dsa5233 2013-12-29 22:37
    关注

    It tells you it needs all tools built before you can use them.

    If your windows GOARCH is amd64, then you could "build" all required tools by running this small batch programs:

    set GOARCH=amd64
    set GOOS=linux
    go tool dist install -v pkg/runtime
    go install -v -a std
    

    If that succeeds then you should be able to do what you've described (just use amd64, not AMD64 - it is case sensitive).

    If your windows GOARCH is 386, then you would need to build your 386 tools first. You would need to download mingw gcc for that. Do what user2714852 said.

    Here https://golang.org/wiki/WindowsCrossCompiling are similar instructions for linux, perhaps you find them helpful.

    Alex

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog