当你开始通过make命令编译运行在X86(也就是本机上运行的)上的驱动程序时,有时候会突然发现报类似如下的错误:
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-52-generic'
arch/x86/Makefile:156: CONFIG_X86_X32 enabled but no binutils support
arch/x86/Makefile:245: *** You are building kernel with non-retpoline compiler, please update your compiler.. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-52-generic'
网上的推荐解决方法,也是错误信息提示我们的“no binutils support”所以我们通常是检查binutils是否安装或者是否版本过久。
但当你执行:
apt-get install binutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
binutils is already the newest version (2.30-21ubuntu1~18.04.2).
当然你也需要确定gcc也被安装
此时,是不是有点崩溃?
**
我的情况及解决方法如下:
**
我在编译安卓内核的时候,需要配置交叉编译链的前缀,为了不需要每次都手动输入,我设置了全局变量:
vim ~/.bashrc
export CROSS_COMPILE=arm-linux-gnueabi-
问题就出在这里,所以很简单我们只需要将他注释掉就可以了!
当然当你source ~/.bashrc完之后,执行make还是一样的报错,此时把该终端关闭重新打开一个就可以了!