binutils使用错误:this linker was not configured to use sysrootscollect2:ld returned 1 exit status

binutils错误,使用gcc -o 连接目标文件时,报错: /usr/local/bin/ld  :this  linker was not configured to use sysrootscollect2:ld returned 1 exit status

也有报错为:  C compiler cannot create executables

这个可能是你/usr/local/bin 目录下的有另一个版本不对应的GNU Linker ld ,

同时你的环境变量把/usr/local/bin 设置在/usr/bin之前,或者没有设置后面那个环境变量。系统依据环境变量查找执行文件时先查找到/usr/local/bin 目录下面的ld ,这个ld的版本不对应,所以报错。

解决方法:只需把/usr/bin环境变量设置在前面,系统先查找到该目录下的ld即可。命令:export PATH="/usr/bin:$PATH"

(我还做了如下处理:先在terminal 转到/home/(username)/tool/binutils-2.16(这个根据你自己的版本情况)然后执行命令:./configure --with-sysroots  这个不是一定要的)

注:上面这种修改只在当前terminal有效。

另一种办法是:把/usr/local/bin里面的ld 改名称,这样系统在路径/usr/local/bin里面查不到 ld ,自然会执行下一个,也就是/usr/bin里面的ld

默认的/usr/bin环境变量是在/usr/local/bin环境变量之后的,第一种把/usr/bin环境变量调前只是暂时的。

命令: sudo mv /usr/local/bin/ld   /usr/local/bin/ldxxxx

(注意:要记住自己做了这种修改,否则下次因为这个出问题,自己又忘记做了这个修改,那就找破头都没办法了。)

PS:查看当前设置的环境变量:export $PATH

设置环境变量:

cd ~

ls .pro* .bash*

gedit .profile

这样即可打开 .profile文件,然后可以在里面添加环境变量。

时间: 2024-08-27 07:45:35

binutils使用错误:this linker was not configured to use sysrootscollect2:ld returned 1 exit status的相关文章

Dev C++中的错误的解决[Linker error] undefined reference to `__dyn_tls_init_callback'

Dev C++中的错误的解决[Linker error] undefined reference to `__cpu_feat... 解决NOIP环境GUIDE和Dev之间的并存问题. 装上了NOIP的测试环境GUIDE后,想再用之前的Dev c++的编译器的时候,发现编译的时候出现问题,无法找到编译连接的库. 错误信息如下: [Linker error] undefined reference to `__cpu_features_init' ld returned 1 exit status

xcode上编译c语言程序报错:ld: x duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

在网上查了一下: duplicate symbol的大概意思是,编译器认为你重复定义了一些东西. linker command failed with exit code 1,则可能是项目引入了多个相同的文件. 结合本人开发中发现此类的问题,解决办法如下: 方法1:查看有问题的文件是否有重复引用.或头文件是否加载了.m 方法2:将有问题的文件删除,重新加载进去.然后:clean->build. 在开发中解决RegexKitlLite的类似问题办法: _rkl_NSExceptionForRege

PostgreSQL源码安装文档

This document describes the installation of PostgreSQL using the source    code distribution. (If you are installing a pre-packaged distribution,    such as an RPM or Debian package, ignore this document and read the    packager's instructions instea

六星经典CSAPP-笔记(7)加载与链接(上)

六星经典CSAPP-笔记(7)加载与链接 1.对象文件(Object File) 1.1 文件类型 对象文件有三种形式: 可重定位对象文件(Relocatable object file):包含二进制代码和数据,能与其他可重定位对象文件在编译时合并创建出一个可执行文件. 可执行对象文件(Executable object file):包含可以直接拷贝进行内存执行的二进制代码和数据. 共享对象文件(Shared object file):一种特殊的可重定位对象文件,能在加载时或运行时,装载进内存进

CentOS7安装oracle 11gR2

最近要运维一个项目,准备在家办公,公司无远程作业环境,个人本本不喜欢别人碰,第一次在CentOS上安装,本案留以后使用,毕竟不是经常安装. 注:Oracle11gR2 X64安装 一.环境准备 安装包: 1.VMware-workstation-full-11.1.0-2496824.exe 2.CentOS-7-x86_64-DVD-1511.iso 3.linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip 以上

Ubuntu 13.04/12.10安装Oracle 11gR2图文教程(转)

Ubuntu 13.04/12.10安装Oracle 11gR2图文教程 原文标题:How to Install Oracle 11G R2 Enterprise Edition Database Ubuntu 12.10 / 12.04 注:原文出自:http://www.techienote.com/tag/oracle-database-11g-r2-on-ubuntu-12-04 Following is the how to for installing Oracle Database

centos7安装oracle12c

linuxamd64_12c_database_1of2.zip  linuxamd64_12c_database_2of2.zip su - root hostnamectl set-hostname centos7.dbaora.com --static #groups for database management /usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 5

在64位主机上编译产生32位的目标代码

   今天又看CS630[1]的Chapter 15,发现里头的一个例程manydots.s无法正常编译. $ gcc manydots.s -o manydots /tmp/ccIvmRVT.o: In function `_start': (.text+0x0): multiple definition of `_start' /usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../../lib/crt1.o:(.text+0x0): first defin

debian下编译libev库

系统为Linux debian 2.6.32-5-686.这是裸系统,连xwindows都没有.帐户为root,不是的注意一下权限.这里想说明安装过程及出现的问题,故打印的信息较多,以供出现错误的读者对比.不需要这些信息的读者勿喷. 网上流行的安装方法: sh autogen.sh 或 ./configure make make install 注意,sh autogen.sh 或 ./configure 只运行其中一个就可以,功能一样.只是autogen.sh调用autoconf来配置参数,.