系统: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. Git中pull对比fetch和merge

    本文参考于:http://www.zhanglian2010.cn/2014/07/git-pull-vs-fetch-and-merge/ 使用git fetch和git pull都可以更新远程仓库 ...

  2. Windows Azure 将正式更名为 Microsoft Azure

    微软的公共云平台在2014年4月3日正式从Windows Azure 更名为Microsoft Azure. windows azure是二级产品名,microsoft azure是一级产品名,和mi ...

  3. 正则提取 html 里<input> 标记的value 值

    获取html 标记的值: :年月日 结果:您选择的是2014年1月22日 使用了Regex 对象,得到一个 MatchCollection,然后进行处理. string mes = @"&l ...

  4. Java线程中带有返回值的线程Callable

    在Java5之前,线程是没有返回值的,常常为了“有”返回值,破费周折,而且代码很不好写.或者干脆绕过这道坎,走别的路了.现在Java终于有可返回值的任务(也可以叫做线程)了. 可返回值的任务必须实现C ...

  5. Android从assets目录下读取文件相关

    有一个需求是app的帮助文档是word格式,ios可以直接用webview加载word显示,Android不行.而美工不配合转换成图片,前端没时间把word写成html 没办法,自己搞. 步骤: 1. ...

  6. TOJ 2776 CD Making

    TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性...  贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题 ...

  7. MySQL存储过程中实现回滚

    用存储过程处理复杂的业务时,可能涉及到对多张表格的操作,在任一个步骤出了问题,就需要对前面的操作回滚.举例实现: DROP PROCEDURE IF EXISTS pro_test; CREATE P ...

  8. Lucene中几种常用的Query

    看完图之后在来详细说明一下. 1.phrasequery是用来查询短语的.注意他只针对英文,对中文并没有什么用处. 核心用法: @Test public void test02(){ //新建查询 P ...

  9. Mac 快捷键

    总结一下: Ctrl + 关机:弹出关机提示 Ctrl + Opt + 关机 : 正常关机快捷键 Cmd + Opt + 关机 :休眠 Ctrl + Cmd + 关机:重启 Shift + Ctrl ...

  10. FruitFrolic

    这是一个连连看小游戏,以 Unity2D 开发.因用了数种水果图片来做头像,所以游戏取名 FruitFrolic.同样,它也只是我闲时的练手. 少时曾玩过掌上游戏机里的俄罗斯方块及打飞机,及手机上的推 ...