菜鸟笔记---Linux下编译时linux/module.h: No such file or directory(详细)

  最近在编译安装软件时,一直报错,提示我

fatel error : linux/module.h: No such file or directory

  查找了一下原因,是因为编译器在make时,会搜索头文件的路径/usr/include/,但是我是移植的debian系统到开发板,并且内核是自己打补丁编译的。导致/usr/include/下面没有linux/module.h相关文件。

  而经过我检查发现,我的linux/module.h文件在/usr/src/linux-4.19.xx/include/linux/module.h。linux-4.19.xx是我之前手动复制过来的,编译内核Image用的kernel源文件。

网上有很多说法,我都进行了尝试,失败的方法列出如下

1、修改安装软件的Makefile,将内核源文件的目录加到make指令后面,例如 -I/usr/src/linux-4.19.xx/include。或者修改CFLAGS 。
  试过这个方法,但是由于make编译时还会搜索/usr/include,导致有些源码内的文件变量命名和/usr/include下的变量名发生冲突。-------失败

2、将module.h直接复制到/usr/include/linux下。这个方法会导致一系列的变量冲突以及文件缺失。原因是:linux源码中的module.h可能是之前在pc上交叉编译的原因,并不适用于开发板上的debian根文件系统。 -------失败

3、使用sudo apt-get install 安装linux-headers,linux-source文件。这种方式只适用于linux内核比较流行,且标准的系统,例如你的pc,或者开发板维护者比较牛逼,有制作l

  • 26
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar zxvf lichee_parrotv1.1_20161202.tar.gz rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ cd lichee/ rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun8iw5p1 Choice: 0 All available platforms: 0. android 1. dragonboard 2. linux 3. tina Choice: 2 All available kernel: 0. linux-3.4 Choice: 0 All available boards: 0. bell-one 1. evb 2. evb-20 3. evb-30 4. evb-rtl8723bs 5. sc3813r Choice: 3 rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh 错误1: KCONFIG_AUTOCONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/autoconf.h KCONFIG_TRISTATE=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/tristate.config BUILDROOT_CONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/.config /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/conf --silentoldconfig Config.in # # make dependencies written to .auto.deps # ATTENTION buildroot devels! # See top of this file before playing with this auto-preprequisites! # make[1]:正在离开目录 `/home/wwt/linux_r16/lichee/buildroot' You must install 'makeinfo' on your build machine makeinfo is usually part of the texinfo package in your distribution make: *** [dependencies] 错误 1 make:离开目录“/home/wwt/linux_r16/lichee/buildroot” ERROR: build buildroot Failed rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ d/buildroot-config/conf.o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/zconf.tab.o -o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buil

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值