当前位置: 代码迷 >> 综合 >> 【igb驱动交叉编译】igb_main.c:10044:7: error: implicit declaration of function ‘isdigit’
  详细解决方案

【igb驱动交叉编译】igb_main.c:10044:7: error: implicit declaration of function ‘isdigit’

热度:80   发布时间:2023-12-22 11:11:35.0

最近igb编译驱动发现了这个问题:

zacha@Superman:~/igb/igb-5.7.2/src$ make
#@+ echo "*** The target kernel has CONFIG_MODULE_SIG_ALL enabled, but" ; echo "*** the signing key cannot be found. Module signing has been" ; echo "*** disabled for this build." ; make ccflags-y="" -C "/lib/modules/4.15.0-142-generic/build" CONFIG_IGB=m CONFIG_MODULE_SIG=n CONFIG_MODULE_SIG_ALL= M="/home/zacha/igb/igb-5.7.2/src" modules 
make -C /home/zacha/yulong810/kernel M=/home/zacha/igb/igb-5.7.2/src CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
make[1]: Entering directory '/home/zacha/yulong810/kernel'CC [M]  /home/zacha/igb/igb-5.7.2/src/igb_main.o
/home/zacha/igb/igb-5.7.2/src/igb_main.c: In function ‘igb_get_os_driver_version’:
/home/zacha/igb/igb-5.7.2/src/igb_main.c:10044:7: error: implicit declaration of function ‘isdigit’ [-Werror=implicit-function-declaration]if(!isdigit(*c) && *c != '.')^~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target '/home/zacha/igb/igb-5.7.2/src/igb_main.o' failed
make[2]: *** [/home/zacha/igb/igb-5.7.2/src/igb_main.o] Error 1
Makefile:1519: recipe for target '_module_/home/zacha/igb/igb-5.7.2/src' failed
make[1]: *** [_module_/home/zacha/igb/igb-5.7.2/src] Error 2
make[1]: Leaving directory '/home/zacha/yulong810/kernel'
Makefile:88: recipe for target 'default' failed
make: *** [default] Error 2

网上也有解决方法:
https://github.com/geerlingguy/raspberry-pi-pcie-devices/issues/3可以参考一下

在igb_main.c 加上 #include <linux/ctype.h>
然后编译通过 ,生成igb.ko

zacha@Superman:~/igb/igb-5.7.2/src$ make
#@+ echo "*** The target kernel has CONFIG_MODULE_SIG_ALL enabled, but" ; echo "*** the signing key cannot be found. Module signing has been" ; echo "*** disabled for this build." ; make ccflags-y="" -C "/lib/modules/4.15.0-142-generic/build" CONFIG_IGB=m CONFIG_MODULE_SIG=n CONFIG_MODULE_SIG_ALL= M="/home/zacha/igb/igb-5.7.2/src" modules 
make -C /home/zacha/yulong810/kernel M=/home/zacha/igb/igb-5.7.2/src CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
make[1]: Entering directory '/home/zacha/yulong810/kernel'CC [M]  /home/zacha/igb/igb-5.7.2/src/igb_main.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_api.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_ethtool.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_hwmon.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_mbx.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_mac.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_manage.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_nvm.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_param.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_phy.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_procfs.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_vmdq.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_82575.oCC [M]  /home/zacha/igb/igb-5.7.2/src/e1000_i210.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_debugfs.oCC [M]  /home/zacha/igb/igb-5.7.2/src/igb_ptp.oCC [M]  /home/zacha/igb/igb-5.7.2/src/kcompat.oLD [M]  /home/zacha/igb/igb-5.7.2/src/igb.oBuilding modules, stage 2.MODPOST 1 modulesCC      /home/zacha/igb/igb-5.7.2/src/igb.mod.oLD [M]  /home/zacha/igb/igb-5.7.2/src/igb.ko
make[1]: Leaving directory '/home/zacha/yulong810/kernel'
  相关解决方案