系统: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. ES6里箭头函数的陷阱

    ECMAScript 6新增了箭头函数 原来的匿名函数 function(){},现在可以简化成()=>{} 看起来高大上,像C#什么的语法. 但是箭头函数的this对象,不能更改,总是指向函数 ...

  2. Java反射遍历数组

    日志中有时候需要查看数组中的值,但是重载很多的打印函数,觉得很别扭.所以想通过反射,获取数组中的值,打印出来.Java提供了数组反射操作的类,之前没有关注过,提供的方法简单易用. public sta ...

  3. Qt Creator pro 文件 导入vs2013碰到的问题

    显示error LNK1117:sytax error in option... 解决办法 从Properties --> Linker --> Command Line 中删掉Addit ...

  4. U-Boot移植

    基于天翔的老师的课程, 他的博客在这儿: http://blog.csdn.net/johnmcu/article/details/6561311 注明不能转载, 就重新写一下吧: 1. 安装韦东山的 ...

  5. 初始python第三天(三)

    全局变量与局部变量 1.什么是全局变量 在globals中的变量,都是全局变量,全局变量的作用域就是整个程序 NAME = 'alex' def global_test(): name = 'alex ...

  6. spine实现预加载(一)

    前言 本文实现了spine动画的预加载,解决在战斗等大量加载spine动画的时候出现卡顿现象. 这里使用和修改三个类,直接修改的源码,当然你也可以继承LuaSkeletonAnimation,自己封装 ...

  7. java URL实现调用其他系统发送报文并获取返回数据

    模拟本系统通过Url方式发送报文到目标服务器,并获取返回数据:(实现类) import java.io.BufferedOutputStream; import java.io.BufferedRea ...

  8. filter-自己的理解

    在配置filter中的拦截功能时候 ,我们在web.xml中进行配置文件.filter过滤文件有系统自己带有的,还有就是我们手写的filter文件.网页调用servlter的时候,我们可以在此之前调用 ...

  9. Java读取Level-1行情dbf文件极致优化(2)

    最近架构一个项目,实现行情的接入和分发,需要达到极致的低时延特性,这对于证券系统是非常重要的.接入的行情源是可以配置,既可以是Level-1,也可以是Level-2或其他第三方的源.虽然Level-1 ...

  10. easyUI 操作

    <a href="javascript:void(0)" onclick="locationUrl()">点击 自动加链接</a> fu ...