I’m trying to build pytorch from source, having just installed MAGMA due to the error
No CUDA implementation of 'potrf'. Install MAGMA and rebuild cutorch
I’m doing this on a 2013 macbook, so I’m aware support is limited, however I did it before so I have faith it will work again!
The problem I’m having is when I try and call setup.py, it keeps referencing a different version of gcc. I have both 8.1.0 and 5.3.0 – 5 is the one I want. I’ve set up environment variables corresponding to this version in ~/.bash_profile
$ echo $CC
/usr/local/bin/gcc-5
$ echo $CXX
/usr/local/bin/g++-5

I’ve also set up symbolic links to /usr/bin/gcc and /usr/bin/g++ in case it was calling them.
However, when I run the command CC=gcc-5 CXX=g++-5 DCUDA_HOST_COMPILER=/usr/local/bin/gcc-5 python setup.py install
I get the error:
-- Caffe2: CUDA detected: 8.0
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 8.0
-- Found cuDNN: v6.0.21  (include: /usr/local/cuda/include, library: /usr/local/cuda/lib/libcudnn.6.dylib)
CMake Error at cmake/public/cuda.cmake:321 (message):
  CUDA 8.0 is not compatible with GCC version >= 6.  Use the following option
  to use another version (for example):

    -DCUDA_HOST_COMPILER=/usr/bin/gcc-5

Call Stack (most recent call first):
  cmake/Dependencies.cmake:401 (include)
  CMakeLists.txt:204 (include)


-- Configuring incomplete, errors occurred!
See also "/Users/askates/Documents/GitRepos/pytorch/build/CMakeFiles/CMakeOutput.log".
See also "/Users/askates/Documents/GitRepos/pytorch/build/CMakeFiles/CMakeError.log".

and when I look at CMakeOutput.log I see it’s referencing /usr/local/bin/gcc-8
How can I make it reference gcc-5 instead of gcc-8? What am I missing?