Install from source for old GPU support. Too new gcc version - no admin rights

Hey, I want to install from source on a Linux machine with a Quadro K4000 GPU and Cuda 9.2 in a conda environment. I followed these instructions, however, in the last step python install I get many error messages of this type:

error: #error – unsupported GNU version! gcc versions later than 7 are not supported!
#error – unsupported GNU version! gcc versions later than 7 are not supported!

gcc --version shows that I have version 8.3.0. I found similar problems here, but the suggested solutions require admin rights, which I don’t have. I was hoping to install an older gcc version via conda (from here on I’m on really thin ice and don’t really know what I am doing). I am not sure which one to use, so I randomly chose conda install -c rgrout gcc_linux-64. At least the results of $CC --version is promising: x86_64-conda_cos6-linux-gnu-cc (crosstool-NG fa8859cb) 6.4.0

To my understanding, I would need to tell the cmake to use ‘my’ gcc via $CC instead of the system one. Is this a promising approach? And how would I do this step? Thanks

EDIT: I tried conda install gcc_linux-64=5.4.0 now and then followed the instructions without explicitly specifying to use the conda gcc. I get this:

The C++ compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /my_home_path/pytorch/build/CMakeFiles/CMakeTmp
    Run Build Command(s):/my_home_path/anaconda3/envs/pt/bin/ninja cmTC_4e2b1 
    [1/2] Building CXX object CMakeFiles/cmTC_4e2b1.dir/testCXXCompiler.cxx.o
    FAILED: CMakeFiles/cmTC_4e2b1.dir/testCXXCompiler.cxx.o 
    /my_home_path/anaconda3/envs/pt/bin/x86_64-conda_cos6-linux-gnu-cc    -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -o CMakeFiles/cmTC_4e2b1.dir/testCXXCompiler.cxx.o -c testCXXCompiler.cxx
    x86_64-conda_cos6-linux-gnu-cc: error trying to exec 'cc1plus': execvp: No such file or directory
    ninja: build stopped: subcommand failed.