The output of command apt-cache policy
as shown:
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
To my understanding this gives information about some package, that which version is installed and in the candidate, it means which version is going to be installed.
What I want to do is basically installed CUDA 8.0, which automatically installs gcc, but because of candidate version of gcc is 7.2.0, it installs this version. However, this afterwards gives compatibility errors.
In summary: I need to install a gcc version less than 5.
I am trying to install torch
using the method described here: link.
The error I get is:
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.
I have installed gcc-4.8
using the command:
sudo apt install gcc-4.8
and then symlinked it by using the command:
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
But still get the same error.
In the Ubuntu package system,
gcc
is a dependency package providing the default GNU C compiler.If you want a non-default compiler version, you can install it explicitly - for example gcc-4.8 is available on artful. You will need to enable the
universe
repository in your package sources.You will likely need to take other steps to make CUDA find the correct versions - for example, creating a
/usr/local/cuda/bin
directory and symbolically linking/usr/bin/gcc-4.8
to/usr/local/cuda/bin/gcc
GCC 4.8.5 is available in 17.10 from the package
gcc-4
.