Repository: pytorch
Issue: Build script complains that gcc is < 6 even though gcc version is 8
Labels: needs reproduction,triaged

## 🐛 Bug

Build script complains that gcc is < 6 even though gcc version is 8. see environment for evidence

## To Reproduce

Steps to reproduce the behavior:

1. Install miniconda3 afresh.
1. Follow instructions to clone and build pytorch: https://github.com/pytorch/pytorch/#from-source
1. python setup.py bdist_wheel

```
(torch_cpu) sasank@qure3:pytorch$ python setup.py bdist_wheel                                                                                                                                                  
Building wheel torch-1.4.0a0+7404463
-- Building version 1.4.0a0+7404463
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/users/sasank/personal/opengc/pytorch/torch -DCMAKE_PREFIX_PATH=/home/users/sasank/miniconda3/envs/torch_cpu -DNUMPY_INCLUDE_DIR=/home/users/sasank/miniconda3/envs/torch_cpu/lib/python3.7/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/home/users/sasank/miniconda3/envs/torch_cpu/bin/python -DPYTHON_INCLUDE_DIR=/home/users/sasank/miniconda3/envs/torch_cpu/include/python3.7m -DPYTHON_LIBRARY=/home/users/sasank/miniconda3/envs/torch_cpu/lib/libpython3.7m.a -DTORCH_BUILD_VERSION=1.4.0a0+7404463 -DUSE_CUDA=0 -DUSE_NUMPY=True /home/users/sasank/personal/opengc/pytorch
CMake Error at cmake/MiscCheck.cmake:29 (message):
  Please use GCC 6 or higher on Ubuntu 17.04 and higher.  For more
  information, see: https://github.com/caffe2/caffe2/issues/1633
Call Stack (most recent call first):
  CMakeLists.txt:369 (include)


-- Configuring incomplete, errors occurred!
See also "/home/users/sasank/personal/opengc/pytorch/build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "setup.py", line 755, in <module>
    build_deps()
  File "setup.py", line 316, in build_deps
    cmake=cmake)
  File "/home/users/sasank/personal/opengc/pytorch/tools/build_pytorch_libs.py", line 59, in build_caffe2                                                                                                      
    rerun_cmake)
  File "/home/users/sasank/personal/opengc/pytorch/tools/setup_helpers/cmake.py", line 319, in generate
    self.run(args, env=my_env)
  File "/home/users/sasank/personal/opengc/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/home/users/sasank/miniconda3/envs/torch_cpu/lib/python3.7/subprocess.py", line 363, in check_call                                                                                                     
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '-GNinja', '-DBUILD_PYTHON=True', '-DBUILD_TEST=True', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_INSTALL_PREFIX=/home/users/sasank/personal/opengc/pytorch/torch', '-DCMAKE_PREFIX_PATH=/home/users/sasank/miniconda3/envs/torch_cpu', '-DNUMPY_INCLUDE_DIR=/home/users/sasank/miniconda3/envs/torch_cpu/lib/python3.7/site-packages/numpy/core/include', '-DPYTHON_EXECUTABLE=/home/users/sasank/miniconda3/envs/torch_cpu/bin/python', '-DPYTHON_INCLUDE_DIR=/home/users/sasank/miniconda3/envs/torch_cpu/include/python3.7m', '-DPYTHON_LIBRARY=/home/users/sasank/miniconda3/envs/torch_cpu/lib/libpython3.7m.a', '-DTORCH_BUILD_VERSION=1.4.0a0+7404463', '-DUSE_CUDA=0', '-DUSE_NUMPY=True', '/home/users/sasank/personal/opengc/pytorch']' returned non-zero exit status 1.                              
(torch_cpu) sasank@qure3:pytorch$ gcc --version
gcc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(torch_cpu) sasank@qure3:pytorch$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

```
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

Build and install happens smoothly.

<!-- A clear and concise description of what you expected to happen. -->

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)
(or fill out the checklist below manually).

You can get the script and run it with:
```
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
```

```
$ python collect_env.py
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Ubuntu 18.04.1 LTS
GCC version: (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
CMake version: version 3.14.0

Python version: 3.7
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce GTX 1080 Ti
Nvidia driver version: 440.44
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.19.1
[conda] blas                      1.0                         mkl
[conda] mkl                       2020.1                      217
[conda] mkl-include               2020.1                      217
[conda] mkl-service               2.3.0            py37he904b0f_0
[conda] mkl_fft                   1.1.0            py37h23d657b_0
[conda] mkl_random                1.1.1            py37h0573a6f_0
[conda] numpy                     1.19.1           py37hbc911f0_0
[conda] numpy-base                1.19.1           py37hfa32c7d_0

```

 - PyTorch Version (e.g., 1.0): tried with master and v1.4.0
 - OS (e.g., Linux): Linux
 - How you installed PyTorch (`conda`, `pip`, source): source
 - Build command you used (if compiling from source): python setup.py install
 - Python version: 3.7
 - CUDA/cuDNN version: None
 - GPU models and configuration: None
 - Any other relevant information:

## Additional context

I installed gcc-8 using command from SO here: https://askubuntu.com/a/1028656



cc @ezyang @gchanan @zou3519