douchuituo3032 2018-01-15 21:35
浏览 1786
已采纳

go交叉编译时出错:不支持的GOOS / GOARCH对linux / amd64

I'm trying to cross-compile go code on windows, targeting linux machine. I have used simple go code to determine target os/platform,

package main

import "fmt"
import "runtime"

func main() {
        fmt.Printf("OS: %s
Architecture: %s
", runtime.GOOS, runtime.GOARCH)
}

Running above code gives me

OS: linux
Architecture: amd64

hovever when I try to cross compile on windows (using JetBrain's Goland IDE) with

> go version
go version go1.9.2 windows/amd64

using GOOS=linux ;GOARCH=amd64 environment flags, I get following error

cmd/go: unsupported GOOS/GOARCH pair linux /amd64

I am new to golang, so I might be missing something simple, but this error got me stuck. Any help appreciated...

  • 写回答

1条回答 默认 最新

  • dtl85148 2018-01-15 21:40
    关注

    It looks like your GOOS is getting set to "linux ", not "linux".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器