<pre><code>$ gccgo --version
gccgo (Ubuntu 6.0.1-0ubuntu1) 6.0.0 20160414 (experimental) [trunk revision 234994]
$ go version
go version go1.8 linux/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/NU-YP/code/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build894555238=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
</code></pre>
<p>I've tried to compile many large projects with gccgo, and it always fails even though gc succeeds. </p>
<p>As a representative example, let's look at <a href="https://github.com/derekparker/delve"><code>github.com/derekparker/delve</code></a>. I obtain the project and its dependencies with <code>go get -u</code>. I edit line 10 of the Makefile to read</p>
<pre><code>BUILD_FLAGS=-ldflags="-X main.Build=$(BUILD_SHA)" -compiler gccgo
</code></pre>
<p>I run <code>make install</code>. I expect that gccgo will compile the program just as well as gc, but instead, it spits out hundreds of errors, so many that I'm not going to include them in this post; find them <a href="http://pastebin.com/LyJJY1na">here</a> instead. What am I doing wrong here?</p>
<hr/>**评论:**<br/><br/>festive_mongoose: <pre><p>I thought gccgo only supports up to go1.2...</p></pre>NeverUse-YouPromised: <pre><p>From the Go 1.8 release notes:</p>
<blockquote>
<p>Due to the alignment of Go's semiannual release schedule with GCC's annual release schedule, GCC release 6 contains the Go 1.6.1 version of gccgo. We expect that the next release, GCC 7, will contain the Go 1.8 version of gccgo.</p>
</blockquote>
<p>I am using version 6 of gccgo, although my GCC version is:</p>
<pre><code>gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
</code></pre></pre>MonkeeSage: <pre><p>You don't have <code>gopkg.in/yaml.v2</code> in a place where gccgo can find it (or it was compiled with gc, which produces libraries that are incompatible with gccgo and must be recompiled with gccgo).</p>
<p><a href="https://golang.org/doc/install/gccgo#Imports" rel="nofollow">https://golang.org/doc/install/gccgo#Imports</a></p></pre>kostix: <pre><p>What <a href="/u/MonkeeSage" rel="nofollow">/u/MonkeeSage</a> said.</p>
<p>The same supposedly applies to <code>golang.org/x/debug/dwarf</code> as well.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传