我正在尝试使用存储库在 Debian 8.3 上安装 virtuabox contrib
。我用的时候apt-get install virtualbox
想安装gcc-4.8
,但是我已经gcc version 4.9.2
安装了。我究竟做错了什么?这样做安全吗?这样我就可以保留我的 gcc-4.9.2 了?
apt-get 输出
apt-get install virtualbox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
cpp-4.8 dkms gcc-4.8 libasan0 libgcc-4.8-dev libgsoap5 libvncserver0
linux-compiler-gcc-4.8-x86 linux-headers-3.16.0-4-amd64
linux-headers-3.16.0-4-common linux-headers-amd64 linux-kbuild-3.16
virtualbox-dkms virtualbox-qt
Suggested packages:
gcc-4.8-locales gcc-4.8-multilib gcc-4.8-doc libgcc1-dbg libgomp1-dbg
libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg
vde2 virtualbox-guest-additions-iso
Recommended packages:
linux-image
The following NEW packages will be installed:
cpp-4.8 dkms gcc-4.8 libasan0 libgcc-4.8-dev libgsoap5
libvncserver0 linux-compiler-gcc-4.8-x86 linux-headers-3.16.0-4-amd64
linux-headers-3.16.0-4-common linux-headers-amd64 linux-kbuild-3.16
virtualbox virtualbox-dkms
virtualbox-qt
0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/35.7 MB of archives.
After this operation, 148 MB of additional disk space will be used.
Do you want to continue? [Y/n]n
apt-cache 策略 virtualbox
virtualbox:
Installed: (none)
Installation candidates: 4.3.32-dfsg-1+deb8u2
Version table:
4.3.32-dfsg-1+deb8u2 0
500 http://httpredir.debian.org/debian/ jessie/contrib amd64 Packages
答案1
我使用方便的 jessie chroot(以避免在我的主系统以及 jessie 上进行实验)验证,安装默认的 jessievirtualbox
软件包 ( 4.3.36-dfsg-1+deb8u1
) 实际上会引入 gcc 4.8 软件包,如下所示。
apt-get install virtualbox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
cpp-4.8 dkms gcc-4.8 kmod libasan0 libgcc-4.8-dev libgsoap5 libvncserver0 linux-compiler-gcc-4.8-x86 linux-headers-3.16.0-4-amd64
linux-headers-3.16.0-4-common linux-headers-amd64 linux-kbuild-3.16 virtualbox-dkms virtualbox-qt
Suggested packages:
gcc-4.8-locales gcc-4.8-multilib gcc-4.8-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg vde2
virtualbox-guest-additions-iso
Recommended packages:
linux-image
The following NEW packages will be installed:
cpp-4.8 dkms gcc-4.8 kmod libasan0 libgcc-4.8-dev libgsoap5 libvncserver0 linux-compiler-gcc-4.8-x86 linux-headers-3.16.0-4-amd64
linux-headers-3.16.0-4-common linux-headers-amd64 linux-kbuild-3.16 virtualbox virtualbox-dkms virtualbox-qt
0 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.9 MB of archives.
After this operation, 149 MB of additional disk space will be used.
这是无害的。然而,默认的jessie virtualbox包是4.3版本,比较老了。您应该使用 jessie backport 5.0virtualbox
包。如果你添加
deb http://httpredir.debian.org/debian/ jessie-backports main contrib non-free
到您的/etc/apt/sources.list
,然后运行apt-get update
,您可以使用以下命令安装 jessie backports virtualbox 5.0 软件包
apt-get install -t jessie-backports virtualbox
jessie backports 5.0 virtualbox 软件包的安装将不是安装海湾合作委员会4.8。
作为参考,请注意添加了 jessie backports,可用的 virtualbox 软件包有:
apt-cache policy virtualbox
virtualbox:
Installed: 5.0.14-dfsg-1~bpo8+1
Candidate: 5.0.14-dfsg-1~bpo8+1
Version table:
5.0.16-dfsg-2 0
50 http://httpredir.debian.org/debian/ unstable/contrib amd64 Packages
*** 5.0.14-dfsg-1~bpo8+1 0
100 http://httpredir.debian.org/debian/ jessie-backports/contrib amd64 Packages
100 /var/lib/dpkg/status
4.3.36-dfsg-1+deb8u1 0
500 http://security.debian.org/ jessie/updates/contrib amd64 Packages
4.3.32-dfsg-1+deb8u2 0
500 http://httpredir.debian.org/debian/ jessie/contrib amd64 Packages
答案2
安装 virtualbox 后您将保留新版本gcc version 4.9
在安装 virtualbox 之前,您可以验证现有版本,您会发现gcc-4.8
和gcc-4.9
gcc-4.8/unknown,stable,stable,stable,now 4.8.4-1 amd64
和
gcc-4.9/stable,stable,stable,now 4.9.2-10 amd64
更新
你需要cat
该/proc/version
文件。该文件标识当前正在运行的内核版本和使用的 gcc 版本。
cat /proc/version
获取 gcc 和 g++ 4.9 的确切路径
which gcc-4.9
which g++-4.9
用于export
指向gcc
路径gcc-4.9
和g++
路径g++-4.9
。
就像是:
export CXX=/usr/bin/g++-4.9 export CC=/usr/bin/gcc-4.9