web-dev-qa-db-ja.com

virtualboxゲストの追加:エラー:カーネル構成が無効です

私がしたこと:

  1. 最小限のdebian/testingをインストール(GUIなし、標準ユーティリティなし)
  2. build-essential、dkms、linux-headers-$(uname -r)をインストールします
  3. [デバイス]-> [ゲスト追加CDを挿入]をクリックします
  4. 実行されたm-a prepare
  5. マウント/dev/sr0どこか、cdそこと./VBoxLinuxAdditions.run

私が得たもの:

...
Building the modules for kernel 5.4.0-4-AMD64.
Look at /var/log/vboxadd-setup.log to find out what went wrong.
modprobe vboxsf failed
...

ログには何があります:

...
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)
    ...

私が調査したもの:

    $modprobe vboxsf
    modprobe: FATAL: Module vboxsf not found in directory /lib/modules/5.4.0-4-AMD
    $lsmod | grep vboxsf
    <no output>
    $find /usr/src/linux-headers-5.4.0-4-AMD64/ -name autoconf.h
    /usr/src/linux-headers-5.4.0-4-AMD64/include/generated/autoconf.h

ホストOSはUbuntu 18です。

編集:openboxをインストールしてXサーバーを取得すると、ログは次のようになります。

# less /var/log/vboxadd-setup.log
Building the main Guest Additions module for kernel 5.4.0-4-AMD64.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/5.4.0-4-AMD64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
make -C /usr/src/linux-headers-5.4.0-4-AMD64 -f /usr/src/linux-headers-5.4.0-4-common/Makefile modules
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 /usr/src/linux-headers-5.4.0-4-common/scripts/Makefile.build obj=/tmp/vbox.0 single-build= need-builtin=1 need-modorder=1
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include -I./Arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include/uapi -I./Arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -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 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -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 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_Arch_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuest_linux"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.c
   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /tmp/vbox.0/VBoxGuest-linux.o
  if objdump -h /tmp/vbox.0/VBoxGuest-linux.o | grep -q __ksymtab; then  gcc-9 -E -D__GENKSYMS__ -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include -I./Arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include/uapi -I./Arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -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 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -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 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_Arch_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuest_linux"' -DKBUILD_MODNAME='"vboxguest"' /tmp/vbox.0/VBoxGuest-linux.c | scripts/genksyms/genksyms    -r /dev/null > /tmp/vbox.0/.tmp_VBoxGuest-linux.ver; ld -m elf_x86_64  -z max-page-size=0x200000 -r -o /tmp/vbox.0/.tmp_VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.o -T /tmp/vbox.0/.tmp_VBoxGuest-linux.ver; mv -f /tmp/vbox.0/.tmp_VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.o; rm -f /tmp/vbox.0/.tmp_VBoxGuest-linux.ver; fi
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include -I./Arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include/uapi -I./Arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -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 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -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 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_Arch_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuest"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuest.o /tmp/vbox.0/VBoxGuest.c
/tmp/vbox.0/VBoxGuest.c: In function ‘vgdrvCheckIfVmmReqIsAllowed’:
/tmp/vbox.0/VBoxGuest.c:2060:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
 2060 |             if (pSession->fUserSession)
      |                ^
/tmp/vbox.0/VBoxGuest.c:2062:9: note: here
 2062 |         case kLevel_AllUsers:
      |         ^~~~
   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /tmp/vbox.0/VBoxGuest.o
  if objdump -h /tmp/vbox.0/VBoxGuest.o | grep -q __ksymtab; then  gcc-9 <compile flags deleted to fit in 30 000 characters>fi
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibGenericRequest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include -I./Arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include/uapi -I./Arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -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 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -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 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_Arch_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibGenericRequest"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.c
   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o
  if objdump -h /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o | grep -q __ksymtab; then  gcc-9 -E -D__GENKSYMS__ -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibGenericRequest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include -I./Arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include/uapi -I./Arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -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 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-<some flags removed to fit into 30 000 char> -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibGenericRequest"' -DKBUILD_MODNAME='"vboxguest"' /tmp/vbox.0/VBoxGuestR0LibGenericRequest.c | scripts/genksyms/genksyms    -r /dev/null > /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.ver; ld -m elf_x86_64  -z max-page-size=0x200000 -r -o /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o -T /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.ver; mv -f /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o; rm -f /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.ver; fi
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibHGCMInternal.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include -I./Arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/Arch/x86/include/uapi -I./Arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -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 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -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 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_Arch_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibHGCMInternal"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.o /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c
In file included from /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h:59,
                 from <command-line>:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalPreprocessCall’:
/usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_attributes.h:200:41: error: expected ‘)’ before ‘__attribute__’
  200 | # define fallthrough                    __attribute__((__fallthrough__))
      |                                         ^~~~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1116:48: note: in expansion of macro ‘fallthrough’
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                ^~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:271:17: note: in expansion of macro ‘RT_FALL_THRU’
  271 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /tmp/vbox.0/include/iprt/types.h:29,
                 from /tmp/vbox.0/VBoxGuestR0LibInternal.h:33,
                 from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:33:
/tmp/vbox.0/include/iprt/cdefs.h:1116:60: error: expected identifier or ‘(’ before ‘)’ token
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                            ^
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:271:17: note: in expansion of macro ‘RT_FALL_THRU’
  271 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h:59,
                 from <command-line>:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalInitCall’:
/usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_attributes.h:200:41: error: expected ‘)’ before ‘__attribute__’
  200 | # define fallthrough                    __attribute__((__fallthrough__))
      |                                         ^~~~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1116:48: note: in expansion of macro ‘fallthrough’
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                ^~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:545:17: note: in expansion of macro ‘RT_FALL_THRU’
  545 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /tmp/vbox.0/include/iprt/types.h:29,
                 from /tmp/vbox.0/VBoxGuestR0LibInternal.h:33,
                 from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:33:
/tmp/vbox.0/include/iprt/cdefs.h:1116:60: error: expected identifier or ‘(’ before ‘)’ token
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                            ^
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:545:17: note: in expansion of macro ‘RT_FALL_THRU’
  545 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h:59,
                 from <command-line>:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalCopyBackResult’:
/usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_attributes.h:200:41: error: expected ‘)’ before ‘__attribute__’
  200 | # define fallthrough                    __attribute__((__fallthrough__))
      |                                         ^~~~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1116:48: note: in expansion of macro ‘fallthrough’
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                ^~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:812:17: note: in expansion of macro ‘RT_FALL_THRU’
  812 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /tmp/vbox.0/include/iprt/types.h:29,
                 from /tmp/vbox.0/VBoxGuestR0LibInternal.h:33,
                 from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:33:
/tmp/vbox.0/include/iprt/cdefs.h:1116:60: error: expected identifier or ‘(’ before ‘)’ token
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                            ^
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:812:17: note: in expansion of macro ‘RT_FALL_THRU’
  812 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalPreprocessCall’:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:259:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
  259 |                 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
      |                    ^
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:273:13: note: here
  273 |             case VMMDevHGCMParmType_LinAddr_In:
      |             ^~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalInitCall’:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:539:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
  539 |                 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
      |                    ^
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:547:13: note: here
  547 |             case VMMDevHGCMParmType_LinAddr_In:
      |             ^~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalCopyBackResult’:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:807:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
  807 |                 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
      |                    ^
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:814:13: note: here
  814 |             case VMMDevHGCMParmType_LinAddr_Out:
      |             ^~~~
make[3]: *** [/usr/src/linux-headers-5.4.0-4-common/scripts/Makefile.build:271: /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-4-common/Makefile:1665: /tmp/vbox.0] Error 2
make[1]: *** [/usr/src/linux-headers-5.4.0-4-common/Makefile:179: sub-make] Error 2
make: *** [/tmp/vbox.0/Makefile.include.footer:100: vboxguest] Error 2

私のコンパイラは:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 9.2.1-30' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-Arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --Host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
gcc version 9.2.1 20200224 (Debian 9.2.1-30)
2
Vorac

仮想ボックスゲスト追加ドライバーのgcc fallthrough属性に関連するマクロとLinuxカーネルヘッダーの間に競合があるようです。

具体的には、仮想ボックスドライバーは次のようなマクロを定義します。

_root@vdebtest:/usr/src/vboxguest-5.1.38$ grep fallthrough -R
vboxvideo/include/iprt/cdefs.h:# define RT_FALL_THROUGH()      __attribute__((fallthrough))
vboxguest/include/iprt/cdefs.h:# define RT_FALL_THROUGH()      __attribute__((fallthrough))
vboxsf/include/iprt/cdefs.h:# define RT_FALL_THROUGH()      __attribute__((fallthrough))
_

しかし include/linux/compiler_attributes.h にあるLinuxカーネルでは、次のようなものがあります。

_/*
 * Add the pseudo keyword 'fallthrough' so case statement blocks
 * must end with any of these keywords:
 *   break;
 *   fallthrough;
 *   goto <label>;
 *   return [expression];
 *
 *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
 */
#if __has_attribute(__fallthrough__)
# define fallthrough                    __attribute__((__fallthrough__))
#else
# define fallthrough                    do {} while (0)  /* fallthrough */
#endif
_

さて、私があなたのビルドログを正しく理解していれば、それらの_RT_FALL_THROUGH_ sは実際には__attribute__((__attribute__((__fallthrough__))))になり、コードをめちゃくちゃにするでしょう。

_/usr/src/vboxguest-x.y.z_ディレクトリに移動して、すべての__attribute__((fallthrough))(これらは私のセットアップでは3つだけです)を__attribute__((__fallthrough__))に置き換えてみてください。 (プレーンfalthroughも機能するはずです)...

次に、それらすべてを_./build_in_tmp_で再構築します。

更新:このトピックについて少し前に不満があったようです here 。そして、これはすでにこれで修正されているようです ticket

1
dragosht