在低版本centos7(我的是7.4)中运行goland编译时报错:
/usr/bin/ld: /tmp/go-link-038275771/000010.o: unrecognized relocation (0x2a) in section `.text'
报错具体如下:
[root@xxx ginlaravel]# go run main.go
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-038275771/000010.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
原因:
ld的版本过低,需要升级一下。
在你的centos7终端运行:
yum install binutils
[root@xxx ~]# yum install binutils
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package binutil