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

我正在尝试为Linux / arm编译Go应用程序,并在我的Ubuntu机器上不断遇到问题。 当我在源目录中运行 GOOS = linux GOARCH = arm go build </ code>时,会出现大量的错误,这些错误是:</ p>


# github.com/huin/mqtt

gccgo:错误:无法识别的命令行选项`-marm </ p>
</ blockquote>

正在运行 gccgo --help </ code>告诉我,以-g,-f -m(及其他)开头的选项将传递给gccgo所启动的任何子进程,所以我不知道它正在发送哪个进程- 破坏。</ p>

有任何线索吗? Ubuntu 14.10 LTS,64位</ p>
</ div>

展开原文

原文

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

doushang4274
doushang4274 花了最后一小时的时间从源代码编译gccgo(以及gcc和g++),但它仍在做同样的事情。它必须是不知道-marm的子过程,但我不知道是哪个。
5 年多之前 回复
dqqpf32897
dqqpf32897 运行gccgo--version报告它是Ubuntu4.9.1-0ubuntu1。运行gcc--version报告是Ubuntu4.8.2-19ubuntu1。我想知道这与它有什么关系,因为我最初是通过apt-get安装golang的,然后再将其删除并更新为最新版本。我对Linux很不满意,但是有时候这些不同的版本会引起我的注意。
5 年多之前 回复
dongxingguo1978
dongxingguo1978 能告诉我们您使用的是什么版本的gcc?
5 年多之前 回复

1个回答



因此,由于Dean的一个线索,我已经解决了该问题并解决了该问题。</ p>

< p>该问题是由于我通过apt-get安装Go,然后通过apt-get删除它,然后从golang网站安装Go引起的。 第一次安装时仍然有一些文件,可能是较旧的版本,因此不支持 -marm </ code>标志。</ p>

我要去 无论如何擦除我的开发机器,所以我做到了,再次安装了Ubuntu,从网站上安装了Go(而不是通过apt-get),并且一切都在第一次运行。 如果您不想擦除计算机,则只需确保四处看看是否存在版本冲突。</ p>

我以前被这种事情所困扰( 通过apt-get安装node.js,意识到它已经过时了很多版本,然后通过源代码删除并安装node.js),因此,如果有人正在阅读此书,请通过apt-get安装软件时要小心, 然后升级,因为您可能会遇到类似的版本问题!</ strong> </ p>
</ div>

展开原文

原文

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!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐