简体   繁体   中英

Failed to specific gcc version when setup python

It seems that there're some conflicts on CUDA 9.0 and GCC 6.x, (discussed here ). So I decide to use gcc 5.5 to setup python package.

According to the answer https://stackoverflow.com/a/25595274/5634636 , and https://stackoverflow.com/a/16737696/5634636 , I tried to run setup.py as follow:

CC=gcc-5 CXX=g++-5 python setup.py install --user

which raise the error (I only paste part of it because it's too long):

/usr/include/c++/6/tuple: In instantiation of 'static constexpr bool std::_TC<, _Elements>::_MoveConstructibleTuple() [with _UElements = {std::tuple};

It seems that python is still using g++ 6 (/usr/include/c++/ 6 /tuple) library on compiling. How to avoid using g++ 6?

It seems that there are two places where gcc is used. One is python setup itself, the other is nvcc . The environment variable CC and CXX only specific the gcc version for python, but it didn't change the gcc version for nvcc .

To change the gcc version cuda used by default, do as follows:

sudo unlink /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/gcc-5 /usr/local/cuda/bin/gcc

There /usr/bin/gcc-5 can be any path to the gcc you want to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM