ubuntu下多个版本gcc配置问题
发表于 : 2014-05-08 11:58
大家好,我在ubuntu下安装CUDA,网上资料说需要4.6版本的gcc,我安装的ubuntu13.04版本(CUDA只有支持12和13的);ubuntu13.04版自带的gcc是4.7的,我重新apt-get gcc-4.6 mv 之前的gcc 重新ln gcc到gcc-4.6 (这是第一个方法);安装报错
“The compiler used to compile the kernel (gcc 4.7) does not exactly match the current compiler (gcc 4.6). The Linux 2.6 kernel module loader rejects kernel modules built with a version of gcc that does not exactly match that of the compiler used to build the running kernel.”
然后用另一种方法(http://www.linuxidc.com/Linux/2012-10/72284.htm)选择gcc-4.6
///*************
sudo apt-get install gcc-4.5 gcc-4.5-multilib g++-4.5 g++-4.5-multilib
安装好后输入以下指令:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 40
接着输入:
sudo update-alternatives --config gcc
会看到如下的选项
有 3 个候选项可用于替换 gcc (提供 /usr/bin/gcc)。
选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/bin/gcc-4.4 50 自动模式
1 /usr/bin/gcc-4.4 50 手动模式
2 /usr/bin/gcc-4.5 40 手动模式
3 /usr/bin/gcc-4.6 30 手动模式
要维持当前值[*]请按回车键,或者键入选择的编号:
要想用哪个gcc就输入编号吧。
////***************************************
安装后错误依然....求指教
“The compiler used to compile the kernel (gcc 4.7) does not exactly match the current compiler (gcc 4.6). The Linux 2.6 kernel module loader rejects kernel modules built with a version of gcc that does not exactly match that of the compiler used to build the running kernel.”
然后用另一种方法(http://www.linuxidc.com/Linux/2012-10/72284.htm)选择gcc-4.6
///*************
sudo apt-get install gcc-4.5 gcc-4.5-multilib g++-4.5 g++-4.5-multilib
安装好后输入以下指令:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 40
接着输入:
sudo update-alternatives --config gcc
会看到如下的选项
有 3 个候选项可用于替换 gcc (提供 /usr/bin/gcc)。
选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/bin/gcc-4.4 50 自动模式
1 /usr/bin/gcc-4.4 50 手动模式
2 /usr/bin/gcc-4.5 40 手动模式
3 /usr/bin/gcc-4.6 30 手动模式
要维持当前值[*]请按回车键,或者键入选择的编号:
要想用哪个gcc就输入编号吧。
////***************************************
安装后错误依然....求指教