Centos7编译Golang报错:/usr/bin/ld: /tmp/go-link-xx0.o: unrecognized relocation (0x2a) in section `.text‘

2023-05-16

在低版本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 binutils.x86_64 0:2.25.1-32.base.el7_4.1 will be updated
---> Package binutils.x86_64 0:2.27-44.base.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch           Version                     Repository    Size
================================================================================
Updating:
 binutils         x86_64         2.27-44.base.el7            base         5.9 M

Transaction Summary
================================================================================
Upgrade  1 Package

Total download size: 5.9 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
binutils-2.27-44.base.el7.x86_64.rpm                       | 5.9 MB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : binutils-2.27-44.base.el7.x86_64                             1/2
  Cleanup    : binutils-2.25.1-32.base.el7_4.1.x86_64                       2/2
  Verifying  : binutils-2.27-44.base.el7.x86_64                             1/2
  Verifying  : binutils-2.25.1-32.base.el7_4.1.x86_64                       2/2

Updated:
  binutils.x86_64 0:2.27-44.base.el7

Complete!

完美解决。

-

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Centos7编译Golang报错:/usr/bin/ld: /tmp/go-link-xx0.o: unrecognized relocation (0x2a) in section `.text‘ 的相关文章

随机推荐

  • 玩客云刷入armbian系统总结

    闲着没事把去年搞的玩客云重新刷个armbian系统作为服务器使用 xff0c 以下是个人折腾的总结 准备工具 xff1a USB 转 TTL 线一根 双公头 USB 线一根 闲置 U 盘一个 xff0c 或者读卡器配合存储卡 软件下载地址
  • 按位与、按位或、按位异或、按位取反、按位左移、按位右移

    位运算符比一般的算术运算符速度要快 xff0c 而且可以实现一些算术运算符不能实现的功能 如果要开发高效率程序 xff0c 位运算符是必不可少的 位运算符用来对二进制位进行操作 xff0c 包括 xff1a 按位与 xff08 amp xf
  • linux—shell中的正则表达式

    一 grep 1 grep概述 文本过滤命令 xff1a grep是一种文本搜索工具 xff0c 根据用户指定的 模式 对目标文本进行匹配检查 xff0c 打印匹配到的行 xff1b grep xff1a 由正则表达式或者字符及基本文本字符
  • LaTeX教程2

    LaTeX教程2 latex10 LaTeX数学公式初步latex11 LaTeX数学模式中的矩阵latex12 LaTeX数学公式的多行公式latex13 LaTeX中的参考文献BibTeXlatex14 LaTeX中的参考文献BibLa
  • Linux深入浅出PyTorch(一)安装及基础知识

    目录 PyTorch安装工具使用1 开发工具建议使用pycharm2 安装包管理工具建议使用Anaconda3 安装结果检查 Pytorch安装2 配置pytorch 虚拟环境3 在PyCharm中配置PyTorch虚拟环境 丰富的PyTo
  • AttributeError: ‘NoneType‘ object has no attribute +++ 错误

    AttributeError 39 NoneType 39 object has no attribute 43 43 43 错误 解决办法 xff1a if self pool is not None self pool reset nu
  • Win11系统联想小新Air14Plus笔记本Anaconda环境下安装PyTorch

    PyTorch 创建虚拟环境 conda create name 名称 python 61 3 6 xff08 python版本 xff09 eg conda create name pytorch python 61 3 6 进入虚拟环境
  • 恒源云配置环境过程

    1 下载oss 软件 2 打开oss 上传数据 输入命令login 登录恒源云账号 输入命令 mkdir oss datasets 在个人数据中建立文件夹 名为 34 datasets 34 输入命令 cp 个人数据 zip oss dat
  • ubuntu 无法进入开机界面

    1 按电源键强制关机 xff0c 然后按电源键重新启动电脑 xff0c 然后在光标选择自己使用的系统 不要按 Enter 回车键 xff0c 然后按 e 键 xff0c 进入grub编辑页面 将光标移动到倒数第二行 xff0c 然后在qui
  • iOS警报– UIAlertController

    In this tutorial we ll be discussing the UIAlertController class and how it is handy to create different types of Alerts
  • jquery 读取XML 文件 并按时间进行排序

    在开发中遇到了一个很烦躁的问题 xff0c 就说在jdk 1 4 的情况下 xff0c 读取远程的XML文件不能自动断开 xff0c 于是就想到了 xff0c 用jQuery来写 在测试的时候使用的是本地的文件 xff0c 可到最后发现 x
  • clickHouse相关知识详解

    clickHouse相关知识详解 clickHouse介绍大数据技术背景什么是clickHouseclickHouse核心特性clickHouse适用场景clickHouse不适用的场景使用clickHouse的大厂 clickHouse安
  • 抖音数据库解析总结

    目前在抖音打出的包里面 xff1a 在database文件夹下面存在存着许多数据库 xff0c 这个大概挨个梳理了一下 xff0c 有用目前就两个数据库 xff1a 抖音id im db eg 95034530671 im db xff1a
  • openfeign实现原理

    1 openfeign简介 OpenFeign 提供了一种声明式的远程调用接口 xff0c 它可以大幅简化远程调用的编程体验 调用其他服务接口像调用本地服务service方法一样丝滑顺畅 使用示例如下 xff1a 引入依赖 span cla
  • MySQL高阶知识点(一):SQL语句执行流程

    1 一条 SQL查询语句是如何被执行的 MySQL 的基本架构示意图如下所示 xff1a 大体来说 xff0c MySQL 可以分为 Server 层和存储引擎层两部分 Server 层包括连接器 查询缓存 分析器 优化器 执行器等 xff
  • Spring Bean生命周期

    1 概述 之前我们在总结Spring扩展点 xff1a 后置处理器时谈到了Spring Bean的生命周期和其对Spring框架原理理解的重要性 xff0c 所以接下来我们就来分析一下Bean生命周期的整体流程 首先Bean就是一些Java
  • MySQL高阶知识点(二):索引概述

    1 深入浅出索引 索引是一种用于快速查询和检索数据的数据结构 常见的索引结构有 B 树 xff0c B 43 树和 Hash 通常来讲 xff0c 索引就像一本中华字典的目录 xff0c 通过目录可以快速定位查找某个汉字在哪一页 xff0c
  • Spring Boot如何优雅提高接口数据安全性

    1 背景 最近我司业务上需要对接第三方各大银行平台 xff0c 调用第三方接口和提供接口供第三方调用 xff0c 这时候的对外open接口安全性就得重视了 xff0c 再有就是之前我在知乎上发布一篇 Spring Security实现后端接
  • python错误解决:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xd1 in position 0: invalid continuat

    当处理文本文档时出现错误 xff1a UnicodeDecodeError utf 8 codec can t decode byte 0xd1 in position 0 invalid continuation byte 可试一下另存为
  • Centos7编译Golang报错:/usr/bin/ld: /tmp/go-link-xx0.o: unrecognized relocation (0x2a) in section `.text‘

    在低版本centos7 xff08 我的是7 4 xff09 中运行goland编译时报错 xff1a usr bin ld tmp go link 038275771 000010 o unrecognized relocation 0x