LoginSignup
1
1

More than 5 years have passed since last update.

VBoxLinuxAdditions.run を実行して gcc: コマンドが見つかりませんでした になった時の対応方法

Last updated at Posted at 2017-07-23

事象 : VBoxLinuxAdditions.run を実行してエラーになってログファイルに gcc: コマンドが見つかりませんでした と書かれていた

$ sudo sh /mnt/cdrom/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.22 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.22 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Starting the VirtualBox Guest Additions.
Failed to set up service vboxadd, please check the log file
/var/log/VBoxGuestAdditions.log for details.

$ vi /var/log/VBoxGuestAdditions.log 
▼▼▼▼▼▼▼▼▼▼▼▼ VBoxGuestAdditions.logの中身 ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼

vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: modprobe vboxguest failed.

$ vi /var/log/vboxadd-install.log
▼▼▼▼▼▼▼▼▼▼▼▼ vboxadd-install.logの中身 ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
grep: /lib/modules/3.10.0-514.26.2.el7.x86_64/build/include/linux/version.h: そのようなファイルやディレクトリはありません
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/3.10.0-514.26.2.el7.x86_64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
arch/x86/Makefile:96: stack-protector enabled but compiler support broken
Makefile:641: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[1]: gcc: コマンドが見つかりませんでした
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)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/vbox.0
  gcc -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem  -I./arch/x86/include -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -m64 -mno-mmx -mno-sse -mno-red-zone -mcmodel=kernel -maccumulate-outgoing-args -Wframe-larger-than=2048 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/lib/modules/3.10.0-514.26.2.el7.x86_64/build/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  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(VBoxGuest_linux)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxguest)" -c -o /tmp/vbox.0/.tmp_VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.c
/bin/sh: gcc: コマンドが見つかりません
make[2]: *** [/tmp/vbox.0/VBoxGuest-linux.o] エラー 127
make[1]: *** [_module_/tmp/vbox.0] エラー 2
make: *** [vboxguest] エラー 2
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

原因 : gccコマンドがインストールされていないから

対応 : gccコマンドをインストールする

$ sudo yum install gcc
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ gcc.x86_64 0:4.8.5-11.el7 を インストール

<省略>

--> 依存性解決を終了しました。

依存性を解決しました

==============================================================================================================================================================
 Package                                 アーキテクチャー                バージョン                                    リポジトリー                      容量
==============================================================================================================================================================
インストール中:
 gcc                                     x86_64                          4.8.5-11.el7                                  base                              16 M
依存性関連でのインストールをします:
 cpp                                     x86_64                          4.8.5-11.el7                                  base                             5.9 M
 glibc-devel                             x86_64                          2.17-157.el7_3.4                              updates                          1.1 M
 glibc-headers                           x86_64                          2.17-157.el7_3.4                              updates                          669 k
 kernel-headers                          x86_64                          3.10.0-514.26.2.el7                           updates                          4.8 M
 libmpc                                  x86_64                          1.0.1-3.el7                                   base                              51 k
 mpfr                                    x86_64                          3.1.1-4.el7                                   base                             203 k

トランザクションの要約
==============================================================================================================================================================
インストール  1 パッケージ (+6 個の依存関係のパッケージ)

総ダウンロード容量: 29 M
インストール容量: 60 M
Is this ok [y/d/N]: y
Downloading packages:
(1/7): glibc-headers-2.17-157.el7_3.4.x86_64.rpm                                                                                       | 669 kB  00:00:01     

<省略>

インストール:
  gcc.x86_64 0:4.8.5-11.el7                                                                                                                                   

依存性関連をインストールしました:
  cpp.x86_64 0:4.8.5-11.el7    glibc-devel.x86_64 0:2.17-157.el7_3.4  glibc-headers.x86_64 0:2.17-157.el7_3.4  kernel-headers.x86_64 0:3.10.0-514.26.2.el7 
  libmpc.x86_64 0:1.0.1-3.el7  mpfr.x86_64 0:3.1.1-4.el7             

完了しました!

$ sudo sh /mnt/cdrom/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.22 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.22 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Starting the VirtualBox Guest Additions.
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1