Skip to content

go build error #31336

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

Closed
lgxxaq opened this issue Apr 8, 2019 · 11 comments
Closed

go build error #31336

lgxxaq opened this issue Apr 8, 2019 · 11 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@lgxxaq
Copy link

lgxxaq commented Apr 8, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.2 linux/amd64

Does this issue reproduce with the latest release?

no

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/work/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/go"
GOPROXY="https://goproxy.io"
GORACE=""
GOROOT="/opt/go/dl/go1.12/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/dl/go1.12/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build907569483=/tmp/go-build"
uname Output
$ uname -a
Linux xx.org 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

What did you do?

go build

What did you expect to see?

build success

What did you see instead?

# hbg_go_houseapp
/opt/go/dl/go1.12.2/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: BFD version 2.20.51.0.2-5.42.el6 20100205 internal error, aborting at reloc.c line 443 in bfd_get_reloc_size
/usr/bin/ld: Please report this bug.
collect2: ld return 1

@agnivade
Copy link
Contributor

agnivade commented Apr 8, 2019

Please mention what it is exactly that you did. We need the repro steps or a sample code that we can use to reproduce the issue ourselves.

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 8, 2019
@aronatkins
Copy link

Given the hello.go from #31293 on a CentOS6 system using go-1.12.2:

# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-618077956/000005.o(.text+0x74): unresolvable H��@�>H��FH��H��H��@�~�F�H��@�~H��8�H��H��0�FH��H��(�FH��H�� �FH��H���FH��H���FH��H��F�fD relocation against symbol `stderr@@GLIBC_2.2.5'
/usr/bin/ld: BFD version 2.20.51.0.2-5.48.el6_10.1 20100205 internal error, aborting at reloc.c line 443 in bfd_get_reloc_size

/usr/bin/ld: Please report this bug.

collect2: ld returned 1 exit status
$ ld -v
GNU ld version 2.20.51.0.2-5.48.el6_10.1 20100205

@agnivade
Copy link
Contributor

agnivade commented Apr 8, 2019

So then this is a duplicate of #31293 ?

Your error seems to be slightly different than OP's though. In any case, I am unable to reproduce this in Ubuntu 18.04.

@ianlancetaylor

@aronatkins
Copy link

@agnivade - Both the OP and my errors are from "el6" - ELPA packages for RHEL/CentOS 6. Maybe the slightly different output is caused by "2.20.51.0.2-5.42.el6 20100205" vs "2.20.51.0.2-5.48.el6_10.1 20100205" patches? The reported lineno and function are the same. Maybe the OP left out one line because it had nonascii characters?

I cannot say if this is a complete duplicate of #31293. Feels connected, though.

@aronatkins
Copy link

Here is a Dockerfile that reproduces the problem:

FROM centos:centos6.10

RUN yum -y install gcc

ENV GOLANG_VERSION 1.12.2
ENV GOLANG_DOWNLOAD_SHA256 f28c1fde8f293cc5c83ae8de76373cf76ae9306909564f54e0edcf140ce8fe3f
RUN curl -fsSL "https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" -o golang.tar.gz \
    && echo "$GOLANG_DOWNLOAD_SHA256  golang.tar.gz" | sha256sum -c - \
    && tar -C /usr/local -xzf golang.tar.gz \
    && rm golang.tar.gz
ENV PATH="$PATH:/usr/local/go/bin"

COPY hello.go hello.go

RUN go build hello.go

It expects the following hello.go (from #31293):

package main

// const int x = 42;
import "C"

import "fmt"

func main() {
	fmt.Println(int(C.x))
}

Given a directory containing this Dockerfile and hello.go:

$ docker build -t foo .
....
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-843872773/000005.o(.text+0x74): unresolvable H��@�>H��FH��H��H��@�~�F�H��@�~H��8�H��H��0�FH��H��(�FH��H�� �FH��H���FH��H���FH��H��F�fD relocation against symbol `stderr@@GLIBC_2.2.5'
/usr/bin/ld: BFD version 2.20.51.0.2-5.48.el6 20100205 internal error, aborting at reloc.c line 443 in bfd_get_reloc_size

/usr/bin/ld: Please report this bug.

collect2: ld returned 1 exit status

The command '/bin/sh -c go build hello.go' returned a non-zero code: 2

@ianlancetaylor
Copy link
Contributor

I'm confident that this is a dup of #31293, so closing.

@vansnyder

This comment has been minimized.

@vansnyder

This comment has been minimized.

@ianlancetaylor

This comment has been minimized.

@vansnyder

This comment has been minimized.

@ianlancetaylor

This comment has been minimized.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants