我尝试在 Linux Mint 17.3 中将内核升级到 4.5,但出现以下错误:
Makefile:666: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
LD /var/lib/dkms/ndiswrapper/1.59/build/built-in.o
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/crt_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/hal_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/ndis_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/ntoskernel_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/ntoskernel_io_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/rtl_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/usb_exports.h
MKSTUBS /var/lib/dkms/ndiswrapper/1.59/build/win2lin_stubs.h
CC [M] /var/lib/dkms/ndiswrapper/1.59/build/crt.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
make[1]: *** [/var/lib/dkms/ndiswrapper/1.59/build/crt.o] Error 1
make: *** [_module_/var/lib/dkms/ndiswrapper/1.59/build] Error 2
make: Leaving directory `/usr/src/linux-headers-4.5.0-040500-generic'
我有 GCC 版本 4.8.4。
以下是gcc升级到4.9后的错误。我在某处读到这是一个错误?
DKMS make.log for ndiswrapper-1.59 for kernel 4.5.0-040500-generic (x86_64)
make: Entering directory `/usr/src/linux-headers-4.5.0-040500-generic'
LD /var/lib/dkms/ndiswrapper/1.59/build/built-in.o
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/crt_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/hal_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/ndis_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/ntoskernel_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/ntoskernel_io_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/rtl_exports.h
MKEXPORT /var/lib/dkms/ndiswrapper/1.59/build/usb_exports.h
MKSTUBS /var/lib/dkms/ndiswrapper/1.59/build/win2lin_stubs.h
CC [M] /var/lib/dkms/ndiswrapper/1.59/build/crt.o
CC [M] /var/lib/dkms/ndiswrapper/1.59/build/hal.o
CC [M] /var/lib/dkms/ndiswrapper/1.59/build/iw_ndis.o
CC [M] /var/lib/dkms/ndiswrapper/1.59/build/loader.o
/var/lib/dkms/ndiswrapper/1.59/build/loader.c: In function ‘load_sys_files’:
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:157:4: error: implicit declaration of function ‘__vmalloc’ [-Werror=implicit-function-declaration]
__vmalloc(load_driver->sys_files[i].size,
^
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:156:19: warning: assignment makes pointer from integer without a cast
pe_image->image =
^
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:207:5: error: implicit declaration of function ‘vfree’ [-Werror=implicit-function-declaration]
vfree(driver->pe_images[i].image);
^
/var/lib/dkms/ndiswrapper/1.59/build/loader.c: In function ‘add_bin_file’:
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:298:2: error: implicit declaration of function ‘vmalloc’ [-Werror=implicit-function-declaration]
bin_file->data = vmalloc(driver_file->size);
^
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:298:17: warning: assignment makes pointer from integer without a cast
bin_file->data = vmalloc(driver_file->size);
^
/var/lib/dkms/ndiswrapper/1.59/build/loader.c: In function ‘wrapper_ioctl’:
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:789:15: warning: assignment makes pointer from integer without a cast
load_driver = vmalloc(sizeof(*load_driver));
^
/var/lib/dkms/ndiswrapper/1.59/build/loader.c: In function ‘wrapper_ioctl_compat’:
/var/lib/dkms/ndiswrapper/1.59/build/loader.c:884:11: warning: assignment makes pointer from integer without a cast
kdriver = vmalloc(sizeof(*kdriver));
^
cc1: some warnings being treated as errors
make[1]: *** [/var/lib/dkms/ndiswrapper/1.59/build/loader.o] Error 1
make: *** [_module_/var/lib/dkms/ndiswrapper/1.59/build] Error 2
make: Leaving directory `/usr/src/linux-headers-4.5.0-040500-generic'
答案1
不确定您是否仍在寻找响应,但我在尝试升级到 4.5.3 内核时遇到了同样的问题。我发现我的系统安装了 gcc-5,并切换到它解决了第一个问题(-fstack-protector-strong)。然后我收到了您列出的有关 ndiswrapper/1.59 的第二组错误。我相信这是该软件中的一个错误,但我找到的解决方案是通过在其中一个源文件中添加两行来修改 ndiswrapper 代码。这使得它能够成功编译。将这些行添加到#include "ndiswrapper.h"
以下中的现有行之前/usr/src/ndiswrapper-1.59/loader.h
:
#define strnicmp strncasecmp // ndis.c fails to compile without this
#include <linux/vmalloc.h> // loader.c fails to compile without this
或者这里有一个简单的脚本来为您进行更新(如果您正确剪切/粘贴):
if ! grep -q strncasecmp /usr/src/ndiswrapper-1.59/loader.h; then
sed -i -e '/ndiswrapper.h/i \
#define strnicmp strncasecmp \
#include <linux/vmalloc.h>' /usr/src/ndiswrapper-1.59/loader.h
fi
答案2
CONFIG_CC_STACKPROTECTOR_STRONG
是 3.14 版中添加的一个内核配置选项-fstack-protector-strong
,使用 进行构建,需要 GCC 4.9。您要么需要将 GCC 升级到 4.9,要么停止使用 构建内核CONFIG_CC_STACKPROTECTOR_STRONG
(前者会更好)。这里有一些背景信息这篇 LWN 文章。