Install gcc 4.7.2 on Debian squeeze 64x

9,057

gcc-4.7.2 was released 3 days ago on September 20th. It won't have made it into the debian repos yet (See update2, thanks derobert).

According to the release notes it is a bug-fixing release so will probably use the same library versions as the previous, 4.7.1, release. So, since 4.7.1 is in the repos, install it to get all the dependencies sorted, then if you really really need the latest version, download the source and compile following the instructions from the gcc website.


UPDATE:

You seem to have a problem with your source.lst. As a workaround, try downloading the package here and installing using dkpg -i gcc_4.7.1-1_amd64.deb.


UPDATE 2:

As @derobert points out below, 4.7.2 is indeed in the experimental repo. So, adapt the instructions from the post you linked to:

Your /etc/apt/sources.list should look something like this:

deb local.debian.mirror squeeze main
deb local.debian.mirror unstable main

while your /etc/apt/preferences should look something like this:

Package: *
Pin: release n=squeeze
Pin-Priority: 900

Package: *
Pin: release n=unstable
Pin-Priority: 200

Then install using apt-get install gcc-4.7/unstable.

As both jordanm and the original tutorial you linked to mention, this is not a very good idea. Make sure to point your sources back to stable once you're finished.

Share:
9,057

Related videos on Youtube

Willem D'Haeseleer
Author by

Willem D'Haeseleer

DevOps Foodie

Updated on September 18, 2022

Comments

  • Willem D'Haeseleer
    Willem D'Haeseleer over 1 year

    I want to use gcc 4.7.2 on my Debian squeeze 64x

    I followed instructions in this thread: Get newest gcc for debian?, but I'm getting an error, I tried several apt-get install commands

    I will settle with 4.7.1, as long as i can use the new c++ 11 features.

    Below are my updated sources list and preferences file. After i updated these files i used apt-get update from a root terminal.

    /etc/apt/sources.list

    #
    
    # deb cdrom:[Debian GNU/Linux 6.0.5 _Squeeze_ - Official amd64 NETINST Binary-1 20120512-20:40]/ squeeze main
    
    #deb cdrom:[Debian GNU/Linux 6.0.5 _Squeeze_ - Official amd64 NETINST Binary-1 20120512-20:40]/ squeeze main
    
    deb http://ftp.belnet.be/debian/ squeeze main
    deb-src http://ftp.belnet.be/debian/ squeeze main
    
    deb http://ftp.belnet.be/debian/ wheezy main
    
    deb http://security.debian.org/ squeeze/updates main
    deb-src http://security.debian.org/ squeeze/updates main
    
    # squeeze-updates, previously known as 'volatile'
    deb http://ftp.belnet.be/debian/ squeeze-updates main
    deb-src http://ftp.belnet.be/debian/ squeeze-updates main
    
    deb http://apt.jenslody.de/stable stable main
    deb-src http://apt.jenslody.de/stable stable main
    deb http://apt.wxwidgets.org/ squeeze-wx main
    

    /etc/apt/preferences

    Package: *
    Pin: release n=squeeze
    Pin-Priority: 900
    
    Package: *
    Pin: release n=wheezy
    Pin-Priority: 200
    

    It seems that this helped but now apt-get is complaining about unmet dependencies

    root@debianWillem:/home/willem# apt-get install gcc-4.7/testing
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Selected version '4.7.1-7' (Debian:testing [amd64]) for 'gcc-4.7'
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     gcc-4.7 : Depends: cpp-4.7 (= 4.7.1-7) but it is not going to be installed
               Depends: binutils (>= 2.21.1) but 2.20.1-16 is to be installed
               Depends: libgcc1 (>= 1:4.7.1-7) but 1:4.4.5-8 is to be installed
               Depends: libgomp1 (>= 4.7.1-7) but 4.4.5-8 is to be installed
               Depends: libmpfr4 (>= 3.1.0) but 3.0.0-2 is to be installed
               Recommends: libc6-dev (>= 2.13-5) but 2.11.3-3 is to be installed
    E: Broken packages
    
    root@debianWillem:/home/willem# apt-get --target-release testing install gcc-4.7
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     initscripts : Breaks: console-setup (< 1.74) but 1.68+squeeze2 is to be installed
                   Breaks: nfs-common (< 1:1.2.5-3) but 1:1.2.2-4squeeze2 is to be installed
     libglib2.0-0 : Breaks: eog (< 3.2.2-3) but 2.30.2-1 is to be installed
     libgnome-keyring0 : Breaks: gnome-keyring (< 3.0) but 2.30.3-5 is to be installed
     network-manager : Recommends: crda but it is not going to be installed
                       Breaks: network-manager-gnome (< 0.9) but 0.8.1-2 is to be installed
    E: Broken packages
    

    How do i resolve these unmet dependencies ?

    • terdon
      terdon over 11 years
      Could you post the apt-get install command you used please?
    • Willem D'Haeseleer
      Willem D'Haeseleer over 11 years
      @derobert i upated my question with the files, i forgot to run apt-get update, i updated my question, it seems like i'm almost there.
  • Willem D'Haeseleer
    Willem D'Haeseleer over 11 years
    i updated my question, please take a look.
  • terdon
    terdon over 11 years
    @helmus, that is strange. Please link to or post your /etc/apt/sources.lst file and also the output of this command: sudo apt-get install gcc/testing
  • derobert
    derobert over 11 years
    FYI, 4.7.2 is in unstable.
  • jordanm
    jordanm over 11 years
    That pinning will likely lead to broken system when he tries to install a package that doesn't exist in stable, it selects the sid version which pulls in sid's libc (just one scenario).
  • Willem D'Haeseleer
    Willem D'Haeseleer over 11 years
    @jordanm so how do i fix that ?