编译驱动模块时,出现如下错误:
make -C "/lib/modules/3.10.0-1160.el7.x86_64/build" M=/root/hydcu_fixup_header/hydcu_pci_fixup_header modules
make[1]: 进入目录“/usr/src/kernels/3.10.0-1160.el7.x86_64”
arch/x86/Makefile:96: stack-protector enabled but compiler support broken
arch/x86/Makefile:166: *** CONFIG_RETPOLINE=y, but not supported by the compiler. Compiler update recommended.。 停止。
make[1]: 离开目录“/usr/src/kernels/3.10.0-1160.el7.x86_64”
make: *** [all] 错误 2
解决办法:
编辑: /usr/src/kernels/3.10.0-1160.el7.x86_64/include/config/auto.conf
/usr/src/kernels/3.10.0-1160.el7.x86_64/.config 这两个文件,搜索CONFIG_RETPOLINE=y等关键字样,然后注释掉。
注: 此环境为centos环境下,kernel后跟的目录为自己环境的内核版本名称,可使用uname -r查看自己所使用的内核版本。编译需要保证环境下安装gcc编译器。