Debian

在 Debian Squeeze 64x 上安裝 gcc 4.7.2

  • September 24, 2012

我想在我的 Debian Squeeze 64x 上使用 gcc 4.7.2

我按照這個執行緒中的說明進行操作:Get latest gcc for debian? ,但出現錯誤,我嘗試了幾個 apt-get install 命令

只要我可以使用新的 c++ 11 功能,我就會選擇 4.7.1。

以下是我更新的來源列表和首選項文件。更新這些文件後,我從根終端使用 apt-get update。

/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/首選項

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

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

似乎這有所幫助,但現在 apt-get 抱怨未滿足的依賴關係

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

我如何解決這些未滿足的依賴關係?

gcc-4.7.2 於 3 天前的 9 月 20 日發布。它還沒有進入 debian repos(請參閱 update2,感謝 derobert)。

根據發行說明,這是一個修復錯誤的版本,因此可能會使用與之前的 4.7.1 版本相同的庫版本。因此,由於 4.7.1 在 repos 中,安裝它以對所有依賴項進行排序,然後如果您真的需要最新版本,請下載原始碼並按照gcc 網站的說明進行編譯。


更新:

您的 source.lst 似乎有問題。作為一種解決方法,請嘗試在此處下載軟體包並使用dkpg -i gcc_4.7.1-1_amd64.deb.


更新 2:

正如@derobert 在下面指出的那樣,4.7.2 確實在實驗性儲存庫中。因此,請調整您連結到的文章中的說明:

/etc/apt/sources.list應該看起來像這樣:

deb *local.debian.mirror*擠壓主要
deb *local.debian.mirror*不穩定主

雖然你/etc/apt/preferences應該看起來像這樣:

包裹: *
引腳:釋放 n=擠壓
引腳優先級:900

包裹: *
引腳:釋放 n=unstable
引腳優先級:200

然後使用apt-get install gcc-4.7/unstable.

正如 jordanm 和您提到的原始教程一樣,這不是一個好主意。完成後,請確保將您的資源指向穩定。

引用自:https://unix.stackexchange.com/questions/48915