Go v1.5使用-linkshared选项会产生链接错误。

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

Go v 1.5 with -linkshared option produces linking error

问题

Go v1.5。

1)编译worker包:

go build -buildmode=shared -linkshared

2)安装该包

3)尝试编译另一个导入worker包的包:

go build -linkshared
go/pkg/tool/linux_amd64/link: 运行gcc失败:退出状态1
gcc: 错误:缺少‘-l’的参数

使用'-x --compiler=gccgo'选项执行相同的命令会产生以下结果:

/usr/bin/gccgo -o $WORK/godev/testgo/_obj/exe/a.out $WORK/godev/testgo/_obj/_go_.o -Wl,-( -m64 -Wl,-) -L/home/user/dev/godev/pkg/gccgo_linux_amd64_fPIC/shlibs -Wl,-rpath=/home/user/dev/godev/pkg/gccgo_linux_amd64_fPIC/shlibs -l -Wl,-E -fPIC
英文:

Go v 1.5.

  1. Compile the package worker:

    go build -buildmode=shared -linkshared

  2. Install this package

  3. Try to compile another package, which imports worker:

    go build -linkshared
    go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
    gcc: error: missing argument to ‘-l’

The same command with '-x --compiler=gccgo' option produces the following:

/usr/bin/gccgo -o $WORK/godev/testgo/_obj/exe/a.out $WORK/godev/testgo/_obj/_go_.o -Wl,-( -m64 -Wl,-) -L/home/user/dev/godev/pkg/gccgo_linux_amd64_fPIC/shlibs -Wl,-rpath=/home/user/dev/godev/pkg/gccgo_linux_amd64_fPIC/shlibs -l -Wl,-E -fPIC

答案1

得分: 0

这是一个在 GitHub 上的错误报告。结果显示,Go 工具生成了错误的名称。

英文:

Here is a bug on github. It turned out that go tool generated wrong names.

huangapple
  • 本文由 发表于 2015年8月20日 17:10:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/32114128.html
匿名

发表评论

匿名网友

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

确定