Compiling Torch on Ubuntu 17.04: No Support for GCC version >5 and Gcc error: gcc: error trying to exec 'cc1': execvp: No such file or directory
Mia Lopez
During my installation of torch on Ubuntu 17.04, I ran into a few problems.
The first report after trying to compile torch was something similar to
giving me something like
error -- unsupported GNU version! gcc >5 are not supported!After I fixed this I got another error similar to here:
Gcc error: gcc: error trying to exec 'cc1': execvp: No such file or directoryWant to also add here that this is in conjunction with my cuda setup.
32 Answers
I fixed the first error by installing gcc-5:
sudo apt-get install gcc-5next, it said it couldnt find cc1, so i did
which cc1which returned a blank. This was because I didn't install g++-5
sudo apt-get install gcc-5 g++-5we next want to make this our default gcc, so
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1and finally
./install.shin the torch directory works. This is similar to the approach here:
torch getting started that started it all:
hope this helps someone
1I had almost the same error messag:
gcc: error trying to exec 'cc1': execvp: No such file or directory
I googled and arrived here. So for the sake of helping people with my same problem... My error was in a different context: trying to compile a go program importing the go-sqlite3 driver...
in my case (ubuntu 16.10 yakkety yak) sudo find /usr/ -name cc1 showed me that cc1 was installed, even several versions:
/usr/lib/gcc/x86_64-linux-gnu/4.9/cc1
/usr/lib/gcc/x86_64-linux-gnu/5/cc1
/usr/lib/gcc/x86_64-linux-gnu/6/cc1I did run which gcc and could see that gcc was pointing to my nvidia cuda driver bin directory, which was including gcc...
In my case this was some residual stuff I didn't uninstall properly, so I had to manually remove that directory from my $PATH in my .bashrc. The I closed my terminal (I've could have run source ~/.bashrc), verified with which gcc that it was pointing to the proper one (/usr/bin/gcc) tried to recompile my go program and it worked without any errors this time.
I know this may not be the perfect answer, but it may point a perso having the same error message to investigate further this kind of stuff.
Of course check which version of gcc you are using, and install the "companion" g++ you need. In my case it was: g++-4.9 (already installed).