go version)?# go version
go version go1.6.1 linux/amd64
go env)?# go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/hyperbuild"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
Tried to build an compile https://github.com/hyperhq/hyperd.git
mkdir -p ${GOPATH}/src/github.com/hyperhq
cd ${GOPATH}/src/github.com/hyperhq
git clone https://github.com/hyperhq/runv.git runv
git clone https://github.com/hyperhq/hyperd.git hyperd
git clone https://github.com/hyperhq/hyperstart.git hyperstart
cd hyperd
./autogen.sh
./configure
make
- What did you expect to see?
Two go binaries hyperd and hyperctlto be built succesfully like it happens in Ubuntu/debian.
During make, the error thrown was:
# make
make[1]: Entering directory '/root/hyperbuild/src/github.com/hyperhq/hyperd'
go build -tags "static_build libdm_no_deferred_remove exclude_graphdriver_btrfs" -ldflags "-X github.com/hyperhq/hyperd/utils.VERSION 0.5.0" hyperd.go
# command-line-arguments
link: warning: option -X github.com/hyperhq/hyperd/utils.VERSION 0.5.0 may not work in future releases; use -X github.com/hyperhq/hyperd/utils.VERSION=0.5.0
**/usr/lib/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1**
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/go-link-108672170/000004.o: unrecognized relocation (0x2a) in section `.text'
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:785: recipe for target 'build-hyperd' failed
make[1]: *** [build-hyperd] Error 2
make[1]: Leaving directory '/root/hyperbuild/src/github.com/hyperhq/hyperd'
Makefile:359: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Posted Makefile with the error above at: http://hastebin.com/evikapojav.mel
Thanks in advance!
Have you checked whether this is a duplicate of any previously-reported Alpine problems? https://github.com/golang/go/issues?utf8=%E2%9C%93&q=is%3Aissue+alpine
/cc @ianlancetaylor
@bradfitz: couldn't figure out, before I posted and therefore created a new issue.
Your linker is complaining about an object that was generated by your compiler or assembler. This is not a Go bug and there is nothing that Go can change that will fix it.
Basically you have an assembler that generates a R_X86_64_REX_GOTPCRELX relocation but your linker doesn't understand it.
Basically a dup of #13678.
go build -a fixed this issue for me
apk add libc-dev fixed this issue for me.
Most helpful comment
apk add libc-devfixed this issue for me.