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

cmd/go: building cgo, "unknown relocation type 42; compiled without -fpic?" #13896

Closed
KALRONG opened this issue Jan 10, 2016 · 10 comments
Closed

Comments

@KALRONG
Copy link

KALRONG commented Jan 10, 2016

hi,

While trying to build go from sources on Debian 8 Stretch I keep getting the following error and the build fails:

/usr/src/go/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?

So far I couldn't find any workaround for this issue.

@davecheney
Copy link
Contributor

I believe this is a binutils bug, it was reported recently by a fedora user and has been escalated to binutils.

On 10 Jan 2016, at 18:19, KALRONG notifications@github.com wrote:

hi,

While trying to build go from sources on Debian 8 Stretch I keep getting the following error and the build fails:

/usr/src/go/pkg/linux_amd64/runtime/cgoa(_allo): unknown relocation type 42; compiled without -fpic?

So far I couldn't find any workaround for this issue


Reply to this email directly or view it on GitHub.

@KALRONG
Copy link
Author

KALRONG commented Jan 10, 2016

Thanks a lot, do you know if there is any workaround in the meantime? maybe another version of binutils?

@mwhudson
Copy link
Contributor

Which version are you building? If it's not the thing Dave's talking about, 1.5.2 and tip should build OK.

@KALRONG
Copy link
Author

KALRONG commented Jan 11, 2016

I tried 1.5.2 and 1.5.3 and had the same issue in both so it seems to be that binutils bug, will wait for debian to get an update

@bradfitz
Copy link
Contributor

@ianlancetaylor, ring any bells?

Also, are we missing builder coverage that we missed this? @KALRONG, what version of binutils do you have?

@bradfitz bradfitz added this to the Go1.6Maybe milestone Jan 21, 2016
@bradfitz bradfitz changed the title /usr/src/go/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic? cmd/go: building cgo, "unknown relocation type 42; compiled without -fpic?" Jan 21, 2016
@ianlancetaylor
Copy link
Contributor

This is a bug in the version of the GNU binutils used on some very up to date Debian systems. Relocation type 42 is being generated by the C assembler but is not being recognized by the C linker. There is nothing that Go can do to fix this.

@bradfitz
Copy link
Contributor

http://linux.debian.bugs.dist.narkive.com/koUKCmST/bug-807136-golang-ftbfs-due-to-new-binutils-relocations suggests this was fixed in Go 1.5.2 via git rev 914db9f? But @KALRONG reports otherwise?

Anyway, I'm happy if @ianlancetaylor is happy.

@ianlancetaylor
Copy link
Contributor

@bradfitz You're right, I did misread the bug. This was a bug in Go, not in the binutils. But I'm reasonably certain that that bug is fixed. @KALRONG are you really sure you still see it?

@bradfitz
Copy link
Contributor

This has been fixed.

I installed a new Debian scratch system in a VM and reproduced the failure with Go 1.5.1, then updated to Go 1.5.2 and it worked fine.

@KALRONG, just use Go 1.5.2+ (1.5.3 is recommended). You must have had a confused path/environment to Go 1.5.n.

screen shot 2016-01-21 at 6 44 25 pm

@KALRONG
Copy link
Author

KALRONG commented Feb 5, 2016

Hi,

Sorry for the delay on replying as I was on vacation and didn't get to check this.

I have done and upgrade on my debian (strecth) and tried compiling again and this time no errors appeared and everything is working as it should with 1.5.3. I didn't change anything else, just updated the debian and then compile from sources.

The only thing I saw is that one of the packages updated was the debian package for go, my guess is that this package in debian (being testing) still had this bug and while I tried to compile from source (needed to add more options than the ones in the debian package) this error showed. This seems to have been fixed on the debian side and now Im able to compile go from source without issues.

Thanks everybody for looking in to this, and sorry for the trouble.

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

6 participants