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

runtime/cgo: build-id=none parameter passed to ld prevents building go from source on CentOS 4 and 5 #9520

Closed
alyandon opened this issue Jan 6, 2015 · 7 comments

Comments

@alyandon
Copy link

alyandon commented Jan 6, 2015

The version of ld that ships with Centos 4/5 does not accept the build-id parameter which causes the build process to abort with the following error:

# runtime/cgo
/usr/bin/ld: unrecognized option '--build-id=none'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

It appears this was added by default in the following commit:

commit 7fdb029
Author: Ian Lance Taylor iant@golang.org
Date: Thu Aug 7 12:38:39 2014 -0700

cmd/go: pass --build-id=none when generating a cgo .o

Some systems, like Ubuntu, pass --build-id when linking.  The
effect is to put a note in the output file.  This is not
useful when generating an object file with the -r option, as
it eventually causes multiple build ID notes in the final
executable, all but one of which are for tiny portions of the
file and are therefore useless.

Disable that by passing an explicit --build-id=none when
linking with -r on systems that might do this.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119460043
@davecheney
Copy link
Contributor

I'm sorry but centos/rhel versions less than 6 are not supported by Go

@mikioh mikioh changed the title build-id=none parameter passed to ld prevents building go from source on Centos 4 and 5 runtime/cgo: build-id=none parameter passed to ld prevents building go from source on CentOS 4 and 5 Jan 6, 2015
@alyandon
Copy link
Author

alyandon commented Jan 6, 2015

Ah, sorry for the noise then.

@ianlancetaylor
Copy link
Contributor

Sadly this will not be the only problem you run into.

@jeffallen
Copy link
Contributor

Here is a workaround for this problem:

http://blog.nella.org/building-go-1-4-when-the-linker-doesnt-know-about-build-id/

While RHEL 5.5 is not supported by Go, with this workaround, the Go toolchain build does complete, and you can use Go 1.4 to build Go tip, and you can use Go tip's compiler. Perhaps the binaries fail in funny ways at runtime due to RHEL 5.5?

@ianlancetaylor
Copy link
Contributor

The Go runtime requires Linux kernel version 2.6.23--which version of the kernel does RHEL 5.5 have?

@alyandon
Copy link
Author

RHEL 5.x is supposedly 2.6.18 - but the real answer is not as simple as comparing version numbers as RedHat actively backports features from later kernels.

http://dave.cheney.net/2013/06/18/how-to-install-go-1-1-on-centos-5

I've compiled Go 1.4 on Cenos 5.x and the test suite appears to complete with no errors except for the file descriptor leak and all the code I've personally tested appears to work. However, I think realistically most simple programs would run fine but you are walking into a potential minefield if you plan on using Go in a non-trivial way on Centos/RHEL 5.

@davecheney
Copy link
Contributor

@alyandon @jeffallen this issue is closed. Please take the discussion elsewhere, probably golang-nuts.

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

5 participants