卸载 gcc 时,以下软件包具有未满足的依赖关系

卸载 gcc 时,以下软件包具有未满足的依赖关系

我正在安装 opencv 2.4.5,但它导致了与本页相同的错误http://answers.opencv.org/question/21715/usrincludehost_configh822-error-error-unsupported-gnu-version-gcc-47-and-up-are-not-supported/为了解决这个问题,我们必须安装 gcc 4.6,而不是 4.7 或更高版本。但是当我通过“sudo apt-get remove ..”或“autoremove”删除 gcc 4.6 时,会出现如下错误:

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:
 dkms : Depends: gcc but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

这是我的 gcc 的版本:

gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

答案1

1)您可以同时安装任意数量的 gcc、g++ 版本。

2)告诉 cmake 使用特定的编译器:CC=gcc-4.6 CXX=g++-4.6 cmake ../

相关内容