系统:ubuntu16.04.1

软件:Virtualbox-5.1

编译器:GCC 4.7.4

在如上环境下安装Vbx5.1提示我在终端执行/sbin/vboxconfig命令

照做

出现如下error

 vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong. There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root.

查看/var/log/vbox-install.log文件得知是由于gcc编译器引起的

gcc: 错误: unrecognized command line option ‘-fstack-protector-strong’

由于我使用ubuntu16.04编译android5.0所以安装了gcc4.7版本,而不是16.04自带的gcc5.4版本

(‘-fstack-protector-strong’ 选项是gcc4.9以后的版本才加入的,也就是说需要安装gcc4.9以后的版本才可以编译通过)

后来在安装VMware的时候,只有使用gcc5.4才可以编译kernel,马上想到Virtualbox5.1是不是也是这个原因造成的,遂尝试之。成了

使用如下命令切换到gcc5.4,即提高gcc5.4的优先级

  sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7

使用gcc -v可知gcc当前版本为5.4,若不是5.4版本,则把5.4的优先级再提高些。

继续执行如下命令

sudo /sbin/vboxconfig

若依旧失败,则卸载掉Virtualbox以及配置文件重新安装即可。

sudo apt-get purge virtualbox

最后重新切换gcc版本回4.7,不然在编译android5.0会出问题

  sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7

在ubuntu16.04上安装Virtualbox5.0的任一版本都会报如下error,内核版本不支持,只有在官网下载最新的Virtualbox.deb才行

 Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modules ...done.
Trying to register the VirtualBox kernel modules using DKMSERROR (dkms apport): kernel package linux-headers-4.4.--generic is not supported
Error! Bad return status for module build on kernel: 4.4.--generic (x86_64)
Consult /var/lib/dkms/vboxhost/5.0./build/make.log for more information.
...failed!
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...failed!
(Look at /var/log/vbox-install.log to find out what went wrong)

注:1.在设置光盘镜像的时候,路径不要包含中文(比如/media下的其他盘符)

  2.windows系统镜像大小最好不要超过4GB,否则会无法启动

ubuntu16.04安装virtualbox5.1失败 gcc:error:unrecognized command line option ‘-fstack-protector-strong’的更多相关文章

  1. linux下安装QT5:error: unrecognized command line option ‘-fuse-ld=gold’

    安装qt时在执行./configure时报错:error: unrecognized command line option '-fuse-ld=gold' 这个错误是qt的一个bug. 在装有gol ...

  2. make module失败的原因cc1: error: unrecognized command line option “-m64

    cc1: error: unrecognized command line option "-m64"cc1: error: unrecognized command line o ...

  3. error: unrecognized command line option "-std=c11" 解决办法

    今天在安装php版本 grpc扩展的时候报错如下: cc1: error: unrecognized command line option "-std=c11" cc1: war ...

  4. cc1plus.exe: error: unrecognized command line option "-fno-keep-inline-dllexport "

    在Windows环境下的控制台上,通过qmake指令编译Qt程序时,出现 cc1plus.exe: error: unrecognized command line option "-fno ...

  5. 编译openwrt时报错:fstools-2018-01-02-11efbf3b/libfstools/overlay.c: At top level: cc1: error: unrecognized command line option '-Wno-format-truncation' [-Werror]

    1. 详细错误信息 [ 11%] Building C object CMakeFiles/fstools.dir/libfstools/overlay.c.o/home/jello/openwrt/ ...

  6. g++: error: unrecognized command line option ‘-std=C++11’

    一个小程序,在编译的时候出错,原来使用的编译命令是 g++ -std=C++11 array.cpp -o array.exe g++: error: unrecognized command lin ...

  7. 安装cmake过程g++: 错误:unrecognized command line option ‘-std=gnu++14’

    问题根因 这个错误一般是gcc/g++版本太低导致的 疑问 我本地明明安装的是高版本的gcc/g++为何说是低版本的呢,有图为证: 这主要是因为你安装了多个版本的gcc/g++,但是默认(/usr/b ...

  8. 进行编译时提示'error: unrecognized command line option "-std=gnu11"'如何处理?

    答: 说明编译器不支持此选项,那么在Makefile中替换此选项-std=gnu11 替换成-std=gnu99或-std=c99或-std=c11等,主要看编译器都支持哪些编译选项,笔者的支持-st ...

  9. ERROR: Unrecognized command line argument: 'use'

    Unrecognized command line argument: 'use' gvm--GoLang语言多版本管理工具 基础环境 centos6.5 报错内容 gvm在命令行以外的任何地方调用 ...

随机推荐

  1. sqlserver数据库 Schema

    //读取数据库中所有的数据库 USE MASTER DECLARE @is_policy_automation_enabled bit SET @is_policy_automation_enable ...

  2. vue.js 渲染完成回调

    vue.js渲染完成后,想触发一些事情,写在哪里呢? 答案是mounted 例子: new Vue({ el:'#demo', data:{ text:'Hello' }, mounted:funct ...

  3. linux shell脚本使用结构化命令(2)

    一.for命令 二.while命令 三.until命令 1.for命令基本格式 for var in list do commands done oracle@suse:~/testshell> ...

  4. quick-cocos2d-x :加入学习

    语法不熟悉, 接口不熟悉. 部分不理解. 超级初学者. 好好学习, 一直在学习 使用Quick-Cocos2d-x搭建一个横版过关游戏 推荐官方的文档和例子  demo

  5. PLSQL Developer导入Excel数据

    LSQL Developer导入Excel数据 最近处理将Excel数据导入Oracle的工作比较多.之前都是采用Sqlldr命令行导入的方式处理.每次导入不同格式的Excel表数据,都需要先把Exc ...

  6. c++中的<<函义

    1.一个是左移运算:x = 4<< 2; 2.输出流运算:cout <<x;//X的值输出流到设备中.

  7. JS子父窗口互相操作取值赋值的方法介绍

    $("#父窗口元素ID",window.parent.document); 对应javascript版本为window.parent.document.getElementById ...

  8. 20145227&20145201 《信息安全系统设计基础》实验五

    北京电子科技学院(BESTI) 实 验 报 告 课程:信息安全系统设计基础 班级:1452 姓名:(按贡献大小排名)鄢曼君 李子璇 学号:(按贡献大小排名)20145227 20145201 成绩: ...

  9. android源码中修改wifi热点默认始终开启

    在项目\frameworks\base\wifi\java\android\net\wifi\WifiStateMachine.java里面,有如下的代码,是设置wifi热点保持状态的:如下: pri ...

  10. spring mvc(注解)上传文件的简单例子

    spring mvc(注解)上传文件的简单例子,这有几个需要注意的地方1.form的enctype=”multipart/form-data” 这个是上传文件必须的2.applicationConte ...