asm/bitsperlong.h: No such file or directory

linux@linux-virtual-machine:~/Desktop/w13_x86_EP$ make
make -C /lib/modules/5.4.0-70-generic/build M=/home/linux/Desktop/w13_x86_EP
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-70-generic'
  AR      /home/linux/Desktop/w13_x86_EP/built-in.a
  CC [M]  /home/linux/Desktop/w13_x86_EP/hello_pcie.o
In file included from ./include/asm-generic/int-ll64.h:11:0,
                 from ./arch/arm/include/uapi/asm/types.h:5,
                 from ./include/uapi/linux/types.h:5,
                 from ./include/linux/types.h:6,
                 from ./include/linux/limits.h:6,
                 from ./include/linux/kernel.h:7,
                 from /home/linux/Desktop/w13_x86_EP/hello_pcie.c:1:
./include/uapi/asm-generic/int-ll64.h:12:29: fatal error: asm/bitsperlong.h: No such file or directory
 #include <asm/bitsperlong.h>
                             ^
compilation terminated.
scripts/Makefile.build:269: recipe for target '/home/linux/Desktop/w13_x86_EP/hello_pcie.o' failed
make[2]: *** [/home/linux/Desktop/w13_x86_EP/hello_pcie.o] Error 1
Makefile:1760: recipe for target '/home/linux/Desktop/w13_x86_EP' failed
make[1]: *** [/home/linux/Desktop/w13_x86_EP] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-70-generic'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2

原因分析:

当前是要编译一个 X86 端运行的内核模块,但在编译日志中出现了 arm 相关字段,因此应该是 ARCH 和 CROSS_COMPILE 设置的不对。

经过检查,发现在 ~/.bashrc 文件中将 ARCH 和 CROSS_COMPILE 配置成了 ARM 开发板的编译选项。将该配置去掉之后,问题消失,编译通过。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值