Sysprogs forums › Forums › VisualKernel › Failed to build test kernel module
- This topic has 1 reply, 2 voices, and was last updated 2 months, 1 week ago by support.
-
AuthorPosts
-
October 11, 2024 at 05:12 #36066sskParticipant
I get the following error when i try to create a new linux kernel module project, at the build step:
Run “make -C “/opt/linux-5.15″ M=”/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9″ V=1 modules” in directory “” on local computer
————————–
make: Entering directory ‘/opt/linux-5.15’
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 ” ERROR: Kernel configuration is invalid.”; \
echo >&2 ” include/generated/autoconf.h or include/config/auto.conf are missing.”;\
echo >&2 ” Run ‘make oldconfig && make prepare’ on kernel src to fix it.”; \
echo >&2 ; \
/bin/false)
make -f ./scripts/Makefile.build obj=/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9 \
single-build= \
need-builtin=1 need-modorder=1
gcc -Wp,-MMD,/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.VisualGDBSpecDetectModule_main.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/11/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -fsanitize=bounds -fsanitize=shift -fsanitize=bool -fsanitize=enum -DMODULE -DKBUILD_BASENAME='”VisualGDBSpecDetectModule_main”‘ -DKBUILD_MODNAME='”VisualGDBSpecDetectModule”‘ -D__KBUILD_MODNAME=kmod_VisualGDBSpecDetectModule -c -o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.c
./tools/objtool/objtool check –module –retpoline –uaccess /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o
if objdump -h /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o | grep -q __ksymtab; then gcc -E -D__GENKSYMS__ -Wp,-MMD,/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.VisualGDBSpecDetectModule_main.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/11/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -fsanitize=bounds -fsanitize=shift -fsanitize=bool -fsanitize=enum -DMODULE -DKBUILD_BASENAME='”VisualGDBSpecDetectModule_main”‘ -DKBUILD_MODNAME='”VisualGDBSpecDetectModule”‘ -D__KBUILD_MODNAME=kmod_VisualGDBSpecDetectModule /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.c | scripts/genksyms/genksyms -r /dev/null > /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.tmp_VisualGDBSpecDetectModule_main.ver; ld -m elf_x86_64 -r -o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.tmp_VisualGDBSpecDetectModule_main.o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o -T /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.tmp_VisualGDBSpecDetectModule_main.ver; mv -f /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.tmp_VisualGDBSpecDetectModule_main.o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o; rm -f /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.tmp_VisualGDBSpecDetectModule_main.ver; fi
ld -m elf_x86_64 -r -o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o
{ echo /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule_main.o; echo; } > /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.mod
{ echo /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.ko; :; } | awk ‘!x[$0]++’ – > /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/modules.order
sh ./scripts/modules-check.sh /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/modules.order
make -f ./scripts/Makefile.modpost
sed ‘s/\.ko$/\.o/’ /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/modules.order | scripts/mod/modpost -m -a -o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/Module.symvers -e -w -T –
make -f ./scripts/Makefile.modfinal
gcc -Wp,-MMD,/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/.VisualGDBSpecDetectModule.mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/11/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -fsanitize=bounds -fsanitize=shift -fsanitize=bool -fsanitize=enum -DMODULE -DKBUILD_BASENAME='”VisualGDBSpecDetectModule.mod”‘ -DKBUILD_MODNAME='”VisualGDBSpecDetectModule”‘ -D__KBUILD_MODNAME=kmod_VisualGDBSpecDetectModule -c -o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.mod.o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.mod.c
ld -r -m elf_x86_64 –build-id=sha1 -T scripts/module.lds -o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.ko /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.o /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.mod.o; true
make: Leaving directory ‘/opt/linux-5.15’
WARNING: Symbol version dump “Module.symvers” is missing.
Modules may not have dependencies or modversions.
You may get many unresolved symbol warnings.
WARNING: modpost: “module_layout” [/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.ko] undefined!
WARNING: modpost: “__fentry__” [/tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.ko] undefined!
ld:scripts/module.lds:53: syntax error
make[2]: *** [scripts/Makefile.modfinal:59: /tmp/VisualGDB-a4d36c22-21b9-4c11-ba57-e56035b9efc9/VisualGDBSpecDetectModule.ko] Error 1
make[1]: *** [scripts/Makefile.modpost:140: __modpost] Error 2
make: *** [Makefile:1783: modules] Error 2
————————–
Command exited with code 2I used ready-to-debug VM with Ubuntu 22.04. When I tried to install kernel sources, I got the following error.
apt-get install -y –force-yes make linux-source-5.15.0=5.15.0-40.43
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package linux-source-5.15.0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another sourceW: –force-yes is deprecated, use one of the options starting with –allow instead.
E: Version ‘5.15.0-40.43’ for ‘linux-source-5.15.0’ was not found
Trying to download and install source package manually…Then I got the required version from launchpad (https://launchpad.net/ubuntu/+source/linux/5.15.0-40.43)
So how do I finally launch custom kernel module?
October 11, 2024 at 08:36 #36067supportKeymasterHi,
Sorry, looks like your kernel headers are corrupt and building modules with them won’t work.
-
AuthorPosts
- You must be logged in to reply to this topic.