gccgo on Precise

此生再无相见时 提交于 2019-12-04 04:38:43

This was recently brought up on the golang-nuts group: compiling with gccgo from packaged binaries.

It's a known issue in Ubuntu (Bug #966570). To work around it, you can link with the static libgcc by specifying -static-libgcc in the gccgoflags. i.e.

go build -compiler gccgo -gccgoflags '-static-libgcc'

From what I can tell, it's because gccgo is based on GCC 4.7, but Precise uses GCC 4.6 by default. For whatever reason, the library paths are incorrect, or the package is incomplete because it's missing libgcc_s.

I located possible libraries with find / -name 'libgcc_s*' and passed the library path like so:

go install -compiler=gccgo -gccgoflags -L/usr/lib/gcc/i686-linux-gnu/4.6 meme/cmd/meme

Note that this is linking against 4.6's libgcc_s, but seems to work anyway.

fainle
/usr/bin/ld: cannot find -lgcc_s (cannot find lgcc_s.so)

gccgo -v (we gcc version 4.7.0 (Ubuntu/Linaro 4.7.0-1ubuntu5) )

locate libgcc_s.so.1 

/lib/i386-linux-gnu/libgcc_s.so.1

ln -sf /lib/i386-linux-gnu/libgcc_s.so.1 /usr/lib/gcc/i686-linux-gnu/4.7.0/libgcc_s.so 

OK

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!