Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to build from source when using the gold linker #1588

Closed
eglaysher opened this issue Mar 8, 2011 · 2 comments
Closed

Failure to build from source when using the gold linker #1588

eglaysher opened this issue Mar 8, 2011 · 2 comments

Comments

@eglaysher
Copy link

When the gold linker is installed, cgo fails to link. Workaround: sudo apt-get remove
binutils-gold.

This version works:
$ /usr/bin/ld --version
GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303

This version does not work:
$ /usr/bin/ld.gold --version
GNU gold (GNU Binutils for Ubuntu 2.20.1-system.20100303) 1.9

Relevant compile log:

--- cd ../misc/cgo/stdio
rm -rf *.o *.a *.[568vq] [568vq].out hello fib chain run.out *.so _obj _test
_testmain.go *.exe _cgo* *.cgo[12].*
CGOPKGPATH= cgo --  align.go file.go test.go test1.go 
touch _obj/_cgo_run
6g -o _go_.6  _obj/align.cgo1.go _obj/file.cgo1.go _obj/test.cgo1.go _obj/test1.cgo1.go
_obj/_cgo_gotypes.go
6c -FVw -I/home/erg/go/pkg/linux_amd64 -I . -o "_cgo_defun.6" _obj/_cgo_defun.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_main.o -c   _obj/_cgo_main.c
gcc -m64 -I . -g -fPIC -O2 -o align.cgo2.o -c   _obj/align.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o file.cgo2.o -c   _obj/file.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o test.cgo2.o -c   _obj/test.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o test1.cgo2.o -c   _obj/test1.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_export.o -c   _obj/_cgo_export.c
gcc -m64 -g -fPIC -O2 -o _cgo1_.o _cgo_main.o align.cgo2.o file.cgo2.o test.cgo2.o
test1.cgo2.o _cgo_export.o  
/usr/bin/ld: _cgo_main.o: in function _cgohack_sys_errlist:_cgo_main.c(.data.rel+0x10):
warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_
_obj/_cgo_import.c
6c -FVw -I . -o "_cgo_import.6" _obj/_cgo_import.c
rm -f _obj/stdio.a
gopack grc _obj/stdio.a _go_.6  _cgo_defun.6 _cgo_import.6 align.cgo2.o file.cgo2.o
test.cgo2.o test1.cgo2.o _cgo_export.o
cp _obj/stdio.a "/home/erg/go/pkg/linux_amd64/stdio.a"
6g hello.go
6l -o hello hello.6
/home/erg/go/pkg/linux_amd64/stdio.a(align.cgo2.o)(.text): fflush: not defined
/home/erg/go/pkg/linux_amd64/stdio.a(file.cgo2.o)(.text): fputs: not defined
/home/erg/go/pkg/linux_amd64/stdio.a(file.cgo2.o)(.text): fflush: not defined
fputs(0): not defined
fflush(0): not defined
make: *** [hello] Error 1
@rsc
Copy link
Contributor

rsc commented Mar 8, 2011

Comment 1:

Hoping Ian will be able to see the problem quickly...

Owner changed to i...@golang.org.

Status changed to Accepted.

@ianlancetaylor
Copy link
Member

Comment 2:

You need a newer version of the gold linker, e.g., the one from the GNU binutils 2.21
release.  The gold which is packaged by Ubuntu does not work on Ubuntu.  This is
unfortunate but they don't seem inclined to change it.

Status changed to Unfortunate.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants