this linker was not configured to use sysroots和C compiler cannot create executables的解决办法

this linker was not configured to use sysroots

C compiler cannot create executables

在ubuntu下想编译linux kernel,键入命令

make menuconfig时,报出

this linker was not configured to use sysroots

查了一下,是因为/usr/local/bin/ld在编译前没有被配置为configure --with-sysroot

所以下载了binutils-2.22想编译一个带sysroot的

键入命令 ../binutils-2.22/configure --with-sysroot

结果报错:

C compiler cannot create executables,打开目录里的config.log

里面也有this linker was not configured to use sysroots的错误信息,

后来查了一下,/usr/bin目录下也有一个ld,用/usr/bin/ld --sysroot=/试了下,没有报错误信息

this linker was not configured to use sysroots,应该是支持sysroot的

然后就把/usr/bin/ld改名为/usr/bin/ldxxxx,命令为

mv /usr/bin/ld /usr/bin/ldxxxx

然后再执行../binutils-2.22/configure --with-sysroot

make

make install

就成功了,这样就可以编译linux内核了,其实只将/usr/local/bin/ld改名为/usr/local/bin/ldxxxx

也应该能在linux内核目录里执行make menuconfig了

原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/2613699.html