雷达智富

首页 > 内容 > 程序笔记 > 正文

程序笔记

编译Linux内核模块时报:WARNING: Symbol version dump "Module.symvers" is missing.

2024-07-20 73

问题描述

我在OpenSUSE Linux中运行make构建一个自定义驱动程序,用于与一些外部设备进行通讯,Makefile在其他Linux系统中make都正常,但就在Open SUSE中编译报警告:WARNING: Symbol version dump “Module.symvers” is missing. 和错误:/bin/sh: scripts/mod/modpost: No such file or directory,详细如下:

~/p/func  sudo make -k
make -C /lib/modules/uname -r/build M=/home/name/programs/func/driver
make[1]: Entering directory /usr/src/linux-5.14.21-150400.22-obj/x86_64/default
WARNING: Symbol version dump Module.symvers is missing.
         Modules may not have dependencies or modversions.
         You may get many unresolved symbol warnings.
  MODPOST /home/name/programs/func/driver/Module.symvers
/bin/sh: scripts/mod/modpost: No such file or directory
make[3]: *** [/usr/src/linux-5.14.21-150400.22/scripts/Makefile.modpost:156: /home/name/programs/func/driver/Module.symvers] Error 127
make[3]: Target __modpost not remade because of errors.
make[2]: *** [/usr/src/linux-5.14.21-150400.22/Makefile:1797: modules] Error 2
make[2]: Target __all not remade because of errors.
make[1]: *** [/usr/src/linux-5.14.21-150400.22/Makefile:220: __sub-make] Error 2
make[1]: Target __all not remade because of errors.
make[1]: Leaving directory /usr/src/linux-5.14.21-150400.22-obj/x86_64/default
make: *** [Makefile:19: driver] Error 2
make -C apps
make[1]: Entering directory /home/name/programs/func/apps
make[1]: Nothing to be done for all.
make[1]: Leaving directory /home/name/programs/func/apps
make: Target all not remade because of errors.

解决办法

在内核目录/usr/src/linux-5.14.21-150400.22-obj/x86_64/default中执行以下命令:

sudo make scripts

然后执行安装:

sudo zypper install kernel-default-devel

再编译就能够正常生成.ko模块了。

更新于:4个月前
赞一波!

文章评论

评论问答