Build failed under go1.17
kwanhur opened this issue · 3 comments
kwanhur commented
[vagrant@lvs bfe]$ rm -fr ~/.cache/go-build/*
[vagrant@lvs bfe]$ make build
go build -ldflags "-X main.version=1.4.0 -X main.commit=f4a1ba9ceb377aff4ed28a91d77a878970e29faa -extldflags=-static"
^@^@# github.com/bfenetworks/bfe
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-298849834/000019.o: In function `pluginOpen':
/usr/local/go/src/plugin/plugin_dlopen.go:20: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-298849834/000004.o: In function `_cgo_3c1cec0c9a4e_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-298849834/000008.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [build] Error 2
environment:
[vagrant@lvs bfe]$ uname -r
3.10.0-327.4.5.el7.x86_64
[vagrant@lvs bfe]$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[vagrant@lvs bfe]$ ld --version
GNU ld version 2.23.52.0.1-55.el7 20130226
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
[vagrant@lvs bfe]$ go version
go version go1.17 linux/amd64
purplegrape commented
try this command:
yum install glibc-static -y
kwanhur commented
try this command: yum install glibc-static -y
had installed before do build, it doesn't matter the upper phenomenon
kwanhur commented
I solved it with upgrade binutils version from 2.23.52.0.1-55 to 2.27-44.base
under centos7 do yum info binutils; yum upgrade binutils
Hope it can help the same users :-)