Building with gccgo gives many import errors on large projects

blov · · 417 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<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=&#34;amd64&#34; GOBIN=&#34;&#34; GOEXE=&#34;&#34; GOHOSTARCH=&#34;amd64&#34; GOHOSTOS=&#34;linux&#34; GOOS=&#34;linux&#34; GOPATH=&#34;/home/NU-YP/code/go&#34; GORACE=&#34;&#34; GOROOT=&#34;/usr/local/go&#34; GOTOOLDIR=&#34;/usr/local/go/pkg/tool/linux_amd64&#34; GCCGO=&#34;/usr/bin/gccgo&#34; CC=&#34;gcc&#34; GOGCCFLAGS=&#34;-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build894555238=/tmp/go-build -gno-record-gcc-switches&#34; CXX=&#34;g++&#34; CGO_ENABLED=&#34;1&#34; PKG_CONFIG=&#34;pkg-config&#34; CGO_CFLAGS=&#34;-g -O2&#34; CGO_CPPFLAGS=&#34;&#34; CGO_CXXFLAGS=&#34;-g -O2&#34; CGO_FFLAGS=&#34;-g -O2&#34; CGO_LDFLAGS=&#34;-g -O2&#34; </code></pre> <p>I&#39;ve tried to compile many large projects with gccgo, and it always fails even though gc succeeds. </p> <p>As a representative example, let&#39;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=&#34;-X main.Build=$(BUILD_SHA)&#34; -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&#39;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&#39;s semiannual release schedule with GCC&#39;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&#39;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

417 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传