我不能使用交叉编译器 [英] I Can not use Cross Compiler
本文介绍了我不能使用交叉编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Windows 10 for Linux(Ubuntu)中编译我的Go代码.
I want to compile my Go code in windows 10 for Linux (Ubuntu).
我使用以下命令:
SET GOOS=linux
SET GOARCH=amd64
go build .\main.go
但是编译器会创建一个.exe文件.
but the compiler creates an .exe file.
如何针对Linux交叉编译此代码?
How to cross-compile this code for linux?
推荐答案
如果使用PowerShell,则应使用 $ Env:GOOS ="linux";$ Env:GOARCH ="amd64";去构建.\ main.go
If you use PowerShell then you should use $Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build .\main.go
这篇关于我不能使用交叉编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文