Debian 6 Squeeze - 安装 build-essentials - gcc / g++

Mai*_*ora 5 debian gcc dependencies

我需要安装c/c++编译器,我听说最好的办法是为此目的安装gcc/g++(我想我的机器上没有它)。

maistora@maistora:~$ gcc --version
bash: gcc: command not found
Run Code Online (Sandbox Code Playgroud)

我还阅读了如果我安装了 build-essential 附带的 c/c++ 编译器。所以我所做的是:

maistora@maistora:~$ sudo apt-get install build-essential
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:
 build-essential : Depends: libc6-dev but it is not going to be installed or
                            libc-dev
                   Depends: gcc (>= 4:4.4.3) but it is not going to be installed
                   Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Broken packages
Run Code Online (Sandbox Code Playgroud)

然后,我不知道为什么,但我决定一个一个安装依赖项并从 开始,libc6-dev这是输出:

maistora@maistora:~$ sudo apt-get install libc6-dev
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:
 libc6-dev : Depends: libc6 (= 2.11.2-10) but 2.13-21 is to be installed
             Depends: libc-dev-bin (= 2.11.2-10) but it is not going to be installed
             Recommends: gcc but it is not going to be installed or
                         c-compiler
E: Broken packages
Run Code Online (Sandbox Code Playgroud)

我做的下一件事是:

maistora@maistora:~$ sudo apt-get install libc6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)

这对我来说似乎很奇怪。但我相信这对你来说是基本的东西。所以,我的问题是 - 如何在我的 Debian 6 Squeeze 或任何安装 gcc/g++ 的解决方法上安装 build-essentials。

PS如果我写sudo apt-get install gcc我会到我的帖子的开头和结尾libc6 is already the newest version.(希望我能把我的观点说清楚)。提前致谢。

Gil*_*il' 3

您似乎混合了 Debian 稳定版 (squeeze) 和 Debian 测试版 (wheezy) 或不稳定版 (sid)。具体来说,您的libc6软件包是测试/不稳定版本,但您的软件包源指向稳定版本。

\n\n

你需要在稳定、测试和不稳定之间选择一个分布 \xe2\x80\x94 你不能真正混合它们(如果你不介意偶尔的烦恼,你可以混合测试和不稳定,但稳定相差太远)。

\n\n

如果您选择稳定,则需要降级您的系统。支持降级apt-get,但您可能会遇到一些麻烦,因为并非所有软件包都支持降级。由于您是 Debian 新手,我建议您重新安装,除非您已经对系统进行了大量自定义。您可以保存和恢复您的主目录;还备份/etc目录,但只能根据具体情况从中恢复文件。

\n\n

如果您选择测试或不稳定,请编辑您的软件源以在现在显示或的位置/etc/apt/sources.list添加或或testingwheezyunstablesidstablesqueeze

\n\n

你是对的,安装build-essential对。而gcc是Linux上事实上的标准C和C++编译器;如果您有非常特殊的要求,您只会使用另一个。

\n