[Linux] 编译模块出现 "./include/linux/kernel.h:6:20: fatal error: stdarg.h: No such file or directory" 错误
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
·
问题现象
在ubuntu 编译一个第三方的驱动 .ko 时,遇到 “./include/linux/kernel.h:6:20: fatal error: stdarg.h: No such file or directory” 报错
原因
缺少的头文件gcc需要
Makefile 如下
obj-m := awusb.o
KDIR_1 := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR_1) SUBDIRS=$(PWD) M=${PWD} modules
clean:
$(MAKE) -C $(KDIR_1) SUBDIRS=$(PWD) M=${PWD} clean
rm -rf Module.markers module.order module.sysvers
解决
两种方法
链接到本地目录
sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h /lib/modules/4.15.0-91-generic/build/include/stdarg.h
Makefile 修改
Makefile 新增一行
ccflags-y = -Wno-declaration-after-statement -mpopcnt -I/usr/lib/gcc/x86_64-linux-gnu/5/include
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。
更多推荐


所有评论(0)