Linux 致命错误asm/bitsperlong.h没有这样的文件或目录
我试图在Ubuntu 14.04上构建一个linux模块 但也有如下错误Linux 致命错误asm/bitsperlong.h没有这样的文件或目录,linux,compilation,Linux,Compilation,我试图在Ubuntu 14.04上构建一个linux模块 但也有如下错误 dhkim@eslee:~/Project/Linux/Hello$ make make -C /lib/modules/3.13.0-106-generic/build M=/home/dhkim/Project/Linux/Hello modules make[1]: Entering directory `/usr/src/linux-headers-3.13.0-106-generic' CC [M] /ho
dhkim@eslee:~/Project/Linux/Hello$ make
make -C /lib/modules/3.13.0-106-generic/build M=/home/dhkim/Project/Linux/Hello modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.0-106-generic'
CC [M] /home/dhkim/Project/Linux/Hello/hello.o
In file included from include/asm-generic/int-ll64.h:10:0,
from /usr/src/linux-headers-3.13.0-106-generic/arch/arm/include/asm/types.h:4,
from include/uapi/linux/types.h:4,
from include/linux/types.h:5,
from include/linux/init.h:5,
from /home/dhkim/Project/Linux/Hello/hello.c:1:
include/uapi/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: No such file or directory
#include <asm/bitsperlong.h>
compilation terminated.
make[2]: *** [/home/dhkim/Project/Linux/Hello/hello.o] error 1
make[1]: *** [_module_/home/dhkim/Project/Linux/Hello] error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-106-generic'
make: *** [default] error 2
--
如何解决此问题?我注意到错误路径中出现了“arm”一词。在为ARM设置交叉编译系统后,我遇到了相同的错误。如果您试图构建一个普通的x86模块,则至少需要临时恢复各种环境变量
export CROSS_COMPILE=
export ARCH=x86_64 [or whatever arch you have]
→ → 从#include
更改为#include
dhkim@eslee:~/Project/Linux/Hello$ uname -r
3.13.0-106-generic
dhkim@eslee:/usr/include$ ls asm
a.out.h errno.h kvm.h mtrr.h prctl.h sigcontext.h svm.h unistd_64.h
auxvec.h fcntl.h kvm_para.h param.h processor-flags.h sigcontext32.h swab.h unistd_x32.h
bitsperlong.h hw_breakpoint.h ldt.h perf_regs.h ptrace-abi.h siginfo.h termbits.h vm86.h
boot.h hyperv.h mce.h poll.h ptrace.h signal.h termios.h vmx.h
bootparam.h ioctl.h mman.h posix_types.h resource.h socket.h types.h vsyscall.h
byteorder.h ioctls.h msgbuf.h posix_types_32.h sembuf.h sockios.h ucontext.h
debugreg.h ipcbuf.h msr-index.h posix_types_64.h setup.h stat.h unistd.hH
e820.h ist.h msr.h posix_types_x32.h shmbuf.h statfs.h unistd_32.h
export CROSS_COMPILE=
export ARCH=x86_64 [or whatever arch you have]