Golang交叉编译:gccgo – 无法识别的命令行选项`-marm`。

huangapple go评论97阅读模式
英文:

Golang cross-compilation: gccgo - unrecognized command line option `-marm`

问题

我正在尝试在我的Ubuntu机器上为linux/arm编译一个Go应用程序,但一直遇到问题。当我在源代码目录中运行GOOS=linux GOARCH=arm go build时,我得到了很多类似以下的错误:

> # github.com/huin/mqtt
>
> gccgo: error: unrecognized command line option `-marm`

运行gccgo --help告诉我以-g、-f、-m(和其他选项)开头的选项将传递给gccgo启动的任何子进程,所以我不知道它是将-marm发送给哪个进程。

有什么线索吗?Ubuntu 14.10 LTS,64位

英文:

I'm trying to compile a Go app for linux/arm and keep running into problems on my Ubuntu machine. When I run GOOS=linux GOARCH=arm go build in my source directory, I get tons of erorrs that are variations of:

> # github.com/huin/mqtt
>
> gccgo: error: unrecognized command line option `-marm`

Running gccgo --help informs me that options starting with -g, -f -m (and others) will be passed on to any sub-processes started by gccgo, so I don't know which process it's sending -marm to.

Any clues? Ubuntu 14.10 LTS, 64bit

答案1

得分: 1

感谢Dean提供的线索,我找到了问题并解决了它。

问题是由于我通过apt-get安装了Go,然后通过apt-get将其删除,然后从golang网站上安装了Go引起的。第一次安装后仍然有一些文件残留,这些文件可能是旧版本,因此不支持“-marm”标志。

我本来打算清除我的开发机器,所以我这样做了,重新安装了Ubuntu,从网站上安装了Go(而不是通过apt-get),一切都一次成功。如果你不想清除你的机器,那么请确保四处查看是否存在版本冲突。

我以前也遇到过这种问题(通过apt-get安装node.js,意识到它已经过时了很多版本,然后删除,通过源码安装node.js),所以如果有人看到这篇文章,请小心使用apt-get安装软件,然后升级,因为你可能会遇到类似的版本问题,就像我一样!

英文:

So thanks to a clue by Dean, I've worked out the issue and solved it.

The issue was caused by me installing Go via apt-get, then removing it (via apt-get), then installing Go from the golang website. There were still files left over from the first install, which were probably older versions and therefore didn't have support for the -marm flag.

I was going to wipe my dev machine anyway, so I did, installed Ubuntu again, installed Go from the website (not via apt-get) and everything worked first time. If you don't want to wipe your machine, then just make sure to look around to see if there are version conflicts.

I've been stung by this sort of thing before (when installing node.js via apt-get, realising it was many versions out of date, then removing, and installing node.js via source), so if anyone is reading this, be careful when installing software via apt-get, then upgrading, as you might have similar version issues like I did!

huangapple
  • 本文由 发表于 2015年1月8日 21:15:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/27841032.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定