2

I'm trying to install virtuabox on Debian 8.3 using the contrib repos. When I use apt-get install virtualbox it wants to install gcc-4.8, but I already have gcc version 4.9.2 installed. What am I doing wrong? Is it safe to do so I can keep my gcc-4.9.2?

apt-get output

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 policy 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
    English output would help. – Faheem Mitha Mar 8 '16 at 22:51
  • updated question. – Cdrmoi Mar 8 '16 at 23:04
  • How did you install your gcc 4.9.2? – bfrguci Mar 8 '16 at 23:10
  • 1
    I don't think it will replace 4.9, though I'm not sure why it is trying to install 4.8 either. On my system, virtualbox certainly doesn't pull that in as a dependency. More details would help. What does apt-cache policy virtualbox say? Also, give the complete output for the apt command, and also the apt command itself. – Faheem Mitha Mar 8 '16 at 23:28
  • edited the Question – Cdrmoi Mar 9 '16 at 13:20
1

I verified, using my handy jessie chroot (to avoid experimenting on my main system, also jessie), that installing the default jessie virtualbox package (4.3.36-dfsg-1+deb8u1) does actually pull in gcc 4.8 packages, as follows.

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.

This is harmless. However, the default jessie virtualbox package is version 4.3, which is rather old. You should use the jessie backport 5.0 virtualbox package. If you add

deb http://httpredir.debian.org/debian/ jessie-backports main contrib non-free

to your /etc/apt/sources.list, and run apt-get update, you can install the jessie backports virtualbox 5.0 package with the command

apt-get install -t jessie-backports virtualbox

The installation of the jessie backports 5.0 virtualbox package will not install gcc 4.8.

For reference, note with jessie backports added, the available virtualbox packages are:

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
1

After installing virtualbox you will keep the new version gcc version 4.9

Before installing virtualbox you can verify existing versions, you will find the gcc-4.8 and gcc-4.9

gcc-4.8/unknown,stable,stable,stable,now 4.8.4-1 amd64 

and

gcc-4.9/stable,stable,stable,now 4.9.2-10 amd64  

Update

You need to cat the /proc/version file. This file identifies the kernel version that is currently running and gcc version used.

cat /proc/version

Get the exact path for gcc and g++ 4.9

which gcc-4.9
which g++-4.9

use export to point gcc to the gcc-4.9 path and g++ to the g++-4.9 path.

Something like:

export CXX=/usr/bin/g++-4.9 export CC=/usr/bin/gcc-4.9

  • dpkg -l gcc* gave me 4.1 up to 4.9. That solved my questions :). How do I specify what version should be used when I run gcc? – Cdrmoi Mar 9 '16 at 13:22
  • @Cdrmoi You don't specify. The release/version specifies the default you use. And this answer doesn't actually explain anything, as far as I can see. It's almost complete gibberish. Sorry. – Faheem Mitha Mar 9 '16 at 20:49
  • You shouldn't mess around with the compiler variables like that; the Virtualbox packages end up installing gcc-4.8 because that's what the kernel was built with, so the Virtualbox kernel module needs to be built with gcc-4.8, not gcc-4.9. Just follow the package setup and use the defaults, and everything will be fine – the module will be built with the right compiler, and the default compiler for everything else will still be 4.9. – Stephen Kitt Mar 9 '16 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.