torch / distro

Torch installation in a self-contained folder
BSD 3-Clause "New" or "Revised" License
556 stars 484 forks source link

unsupported GNU version! gcc versions later than 5.3 are not supported #219

Closed tabsun closed 6 years ago

tabsun commented 7 years ago

I got this error when executing ./install.sh on my Ubuntu 16.04 with gcc-5.4. And it occurs at this position in install.sh line 129:

if [ -x "$path_to_nvcc" ] then echo "Found CUDA on your machine. Installing CUDA packages" cd ${THIS_DIR}/extra/cutorch && $PREFIX/bin/luarocks make rocks/cutorch-scm-1.rockspec || exit 1 cd ${THIS_DIR}/extra/cunn && $PREFIX/bin/luarocks make rocks/cunn-scm-1.rockspec || exit 1 fi

The log info looks like this: `echo "Building on $jopts cores" cmake -E make_directory build && cd build && cmake .. -DLUALIB= -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/tabsun/proj/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/tabsun/proj/torch/install/lib/luarocks/rocks/cutorch/scm-1" && make -j$jopts install

Building on 4 cores -- Found Torch7 in /home/tabsun/proj/torch/install -- Removing -DNDEBUG from compile flags -- TH_LIBRARIES: TH -- MAGMA not found. Compiling without MAGMA support -- Automatic GPU detection failed. Building for common architectures. -- Autodetected CUDA architecture(s): 3.0;3.5;5.0;5.2;6.0;6.1;6.1+PTX -- got cuda version 8.0 -- Found CUDA with FP16 support, compiling with torch.CudaHalfTensor -- CUDA_NVCC_FLAGS: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_61,code=compute_61;-DCUDA_HAS_FP16=1 -- THC_SO_VERSION: 0 -- Configuring done -- Generating done -- Build files have been written to: /home/tabsun/proj/torch/extra/cutorch/build [ 1%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/THC_generated_THCReduceApplyUtils.cu.o [ 2%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/THC_generated_THCHalf.cu.o [ 3%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/THC_generated_THCSleep.cu.o [ 4%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o In file included from /usr/local/cuda/include/cuda_runtime.h:78:0, from :0: /usr/local/cuda/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

^ In file included from /usr/local/cuda/include/cuda_runtime.h:78:0, from :0: /usr/local/cuda/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

^ In file included from /usr/local/cuda/include/cuda_runtime.h:78:0, from :0: /usr/local/cuda/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

^ In file included from /usr/local/cuda/include/cuda_runtime.h:78:0, from :0: /usr/local/cuda/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

^ CMake Error at THC_generated_THCBlas.cu.o.cmake:207 (message): Error generating /home/tabsun/proj/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:70: 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 make[2]: Waiting for unfinished jobs.... CMake Error at THC_generated_THCSleep.cu.o.cmake:207 (message): Error generating /home/tabsun/proj/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCSleep.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:77: 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 CMake Error at THC_generated_THCReduceApplyUtils.cu.o.cmake:207 (message): Error generating /home/tabsun/proj/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCReduceApplyUtils.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:63: 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/tabsun/proj/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCHalf.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:560: 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:127: recipe for target 'all' failed make: *** [all] Error 2

Error: Build error: Failed building.`

I have tried to comment the GNU version detection in /usr/local/cuda/include/host_config.h, it failed. Also I checked the nvidia website, it says cuda 8.0 supports gcc 5.4. Expanded developer platform support including Microsoft Visual Studio 2015 (updates 2 and 3) and GCC 5.4 (Ubuntu 16.04).

So why I got this error? I also installed tensorflow on this machine and it works well so there should be no problem with cuda's installation, I think. Any idea about this situation is REALLY APPRECIATED!

ibmua commented 7 years ago

Way around this

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
xiaofanglegoc commented 7 years ago

@ibmua solved my problem

xiaofanglegoc commented 7 years ago

my cuda is 8 which is not compatible with caffe

rraallvv commented 6 years ago

@ibmua I tried your suggestion on a Google Colab notebook and I'm getting the error below

! add-apt-repository -y ppa:ubuntu-toolchain-r/test ! apt-get update ! apt-get install gcc-4.9 g++-4.9

gpg: keybox '/tmp/tmpem92_vqr/pubring.gpg' created
gpg: /tmp/tmpem92_vqr/trustdb.gpg: trustdb created
gpg: key 1E9377A2BA9EF27F: public key "Launchpad Toolchain builds" imported
gpg: Total number processed: 1
gpg:               imported: 1
OK
Get:1 file:/var/cuda-repo-8-0-local-ga2  InRelease
Ign:1 file:/var/cuda-repo-8-0-local-ga2  InRelease
Get:2 file:/var/cuda-repo-8-0-local-ga2  Release [574 B]
Get:2 file:/var/cuda-repo-8-0-local-ga2  Release [574 B]
Hit:4 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu artful InRelease
Hit:5 http://archive.ubuntu.com/ubuntu artful InRelease
Get:6 http://security.ubuntu.com/ubuntu artful-security InRelease [78.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu artful-updates InRelease [78.6 kB]
Get:8 http://archive.ubuntu.com/ubuntu artful-backports InRelease [72.2 kB]
Fetched 229 kB in 1s (192 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package gcc-4.9 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package g++-4.9 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gcc-4.9' has no installation candidate
E: Package 'g++-4.9' has no installation candidate
Dillonsd commented 6 years ago

you could try manually installing gcc using these instructions https://gist.github.com/jtilly/2827af06e331e8e6b53c

hana9090 commented 6 years ago

@ibmua I tried your approach, however, I can't install g++-4.9 Package g++-4.9 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'g++-4.9' has no installation candidate

ibmua commented 6 years ago

Srsly, just get PyTorch, Torch something of a discontinued project.

dufferzafar commented 6 years ago

@rraallvv I have this error too (on Google Colab!) Did you find a fix?

rraallvv commented 6 years ago

@dufferzafar there is a notebook here that might be of some help, the related discussion is here. Cheers!

markroxor commented 6 years ago

Use cmake -DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9 .. before cmake to specify gcc/g++ compiler. Only this solution worked for me.

binary-person commented 5 years ago

Just install 4.8 and make it default. Besides, gcc version 4.9 is officially not supported Google Colab:

!sudo update-alternatives --remove-all gcc 
!sudo update-alternatives --remove-all g++

!sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
!sudo apt-get update

!sudo apt-get install gcc-4.8 g++-4.8

!sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
!sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

!sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 50
!sudo update-alternatives --set cc /usr/bin/gcc

!sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 50
!sudo update-alternatives --set c++ /usr/bin/g++

!sudo update-alternatives --config gcc
!sudo update-alternatives --config g++

Normal Ubuntu Machine:

sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update

sudo apt-get install gcc-4.8 g++-4.8

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 50
sudo update-alternatives --set cc /usr/bin/gcc

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 50
sudo update-alternatives --set c++ /usr/bin/g++

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

If you want to completely remove the new version, which I highly don't recommend, because it uninstalls everything that requires gcc to run including your CUDA drivers Google Colab:

!sudo apt-get remove gcc g++ -y
!sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
!sudo apt-get update
!sudo apt-get install gcc-4.8 -y
!sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50

Normal Ubuntu Machine:

sudo apt-get remove gcc g++ -y
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install gcc-4.8 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50