命令的输出apt-cache policy
如图所示:
mobeen@VIP-Ubuntu:~$ apt-cache policy gcc
gcc:
Installed: (none)
Candidate: 4:7.2.0-1ubuntu1
Version table:
4:7.2.0-1ubuntu1 500
500 http://kr.archive.ubuntu.com/ubuntu artful/main amd64 Packages
mobeen@VIP-Ubuntu:~$ apt-cache policy g++
g++:
Installed: (none)
Candidate: 4:7.2.0-1ubuntu1
Version table:
4:7.2.0-1ubuntu1 500
500 http://kr.archive.ubuntu.com/ubuntu artful/main amd64 Packages
据我理解,这提供了有关某些包的信息,即安装了哪个版本以及在候选中,这意味着将要安装哪个版本。
我要做的基本上是安装 CUDA 8.0,它会自动安装 gcc,但由于 gcc 的候选版本是 7.2.0,因此它会安装此版本。然而,这随后会出现兼容性错误。
总结一下:我需要安装一个低于5的gcc版本。
我正在尝试torch
使用此处描述的方法进行安装:关联。
我收到的错误是:
In file included from /usr/local/cuda/include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/local/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
In file included from /usr/local/cuda/include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/local/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
In file included from /usr/local/cuda/include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/local/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
In file included from /usr/local/cuda/include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/local/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
CMake Error at THC_generated_THCSleep.cu.o.cmake:207 (message):
Error generating
/home/mobeen/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCSleep.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:665: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCSleep.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCSleep.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMake Error at THC_generated_THCBlas.cu.o.cmake:207 (message):
Error generating
/home/mobeen/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:476: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o] Error 1
CMake Error at THC_generated_THCReduceApplyUtils.cu.o.cmake:207 (message):
Error generating
/home/mobeen/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCReduceApplyUtils.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:286: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCReduceApplyUtils.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCReduceApplyUtils.cu.o] Error 1
CMake Error at THC_generated_THCHalf.cu.o.cmake:207 (message):
Error generating
/home/mobeen/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCHalf.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:2027: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCHalf.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCHalf.cu.o] Error 1
CMakeFiles/Makefile2:172: recipe for target 'lib/THC/CMakeFiles/THC.dir/all' failed
make[1]: *** [lib/THC/CMakeFiles/THC.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Error: Build error: Failed building.
我已经gcc-4.8
使用以下命令安装:
sudo apt install gcc-4.8
然后使用以下命令对其进行符号链接:
sudo ln -s /usr/bin/gcc-4.8 /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/g++-4.8 /usr/local/cuda/bin/g++
sudo ldconfig
但仍然出现相同的错误。
答案1
在 Ubuntu 软件包系统中,gcc
依赖包提供了默认GNU C 编译器。
如果你想要非默认编译器版本,你可以明确安装它 - 例如 gcc-4.8可在 artful 上购买。您需要universe
在软件包源中启用存储库。
您可能需要采取其他步骤来让 CUDA 找到正确的版本 - 例如,创建一个/usr/local/cuda/bin
目录并符号链接/usr/bin/gcc-4.8
到/usr/local/cuda/bin/gcc
答案2
总结一下:我需要安装一个低于5的gcc版本。
17.10 版中可以从软件包中获得 GCC 4.8.5 gcc-4
。