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 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译