Repository: pytorch
Issue: Installation from source fails on macOS (No CUDA)
Labels: module: build,module: cuda,triaged,module: macos

## 🐛 Bug

When trying to run the installation from source on macOS, I get an error and the installation doesn't work.
I am on macOS 10.15.5, python 3.7.6.

## To Reproduce

1.
```
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
```
2.
```
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
```
3. Here is the error:
```
[ 92%] Built target complex_test
Undefined symbols for architecture x86_64:
  "___kmpc_end_serialized_parallel", referenced from:
      TestParallel_NestedParallel_Test::TestBody() in test_parallel.cpp.o
      TestParallel_Exceptions_Test::TestBody() in test_parallel.cpp.o
  "___kmpc_fork_call", referenced from:
      TestParallel_NestedParallel_Test::TestBody() in test_parallel.cpp.o
      TestParallel_Exceptions_Test::TestBody() in test_parallel.cpp.o
  "___kmpc_global_thread_num", referenced from:
      TestParallel_NestedParallel_Test::TestBody() in test_parallel.cpp.o
      TestParallel_Exceptions_Test::TestBody() in test_parallel.cpp.o
  "___kmpc_serialized_parallel", referenced from:
      TestParallel_NestedParallel_Test::TestBody() in test_parallel.cpp.o
      TestParallel_Exceptions_Test::TestBody() in test_parallel.cpp.o
  "_omp_get_num_threads", referenced from:
      _.omp_outlined. in test_parallel.cpp.o
      _.omp_outlined..33 in test_parallel.cpp.o
      _.omp_outlined..35 in test_parallel.cpp.o
  "_omp_get_thread_num", referenced from:
      _.omp_outlined. in test_parallel.cpp.o
      _.omp_outlined..33 in test_parallel.cpp.o
      _.omp_outlined..35 in test_parallel.cpp.o
  "_omp_in_parallel", referenced from:
      TestParallel_NestedParallel_Test::TestBody() in test_parallel.cpp.o
      TestParallel_Exceptions_Test::TestBody() in test_parallel.cpp.o
ld: symbol(s) not found for architecture x86_64
[ 92%] Built target pattern_net_transform_test
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test_parallel] Error 1
[ 92%] Built target NamedTensor_test
make[1]: *** [caffe2/CMakeFiles/test_parallel.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 93%] Built target init_test
[ 93%] Built target scalar_tensor_test
[ 93%] Built target scalar_test
[ 93%] Built target ssa_test
[ 93%] Built target kernel_lambda_test
[ 93%] Built target context_test
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 732, in <module>
    build_deps()
  File "setup.py", line 316, in build_deps
    cmake=cmake)
  File "/Users/clementjoudet/dev/pytorch/tools/build_pytorch_libs.py", line 62, in build_caffe2
    cmake.build(my_env)
  File "/Users/clementjoudet/dev/pytorch/tools/setup_helpers/cmake.py", line 345, in build
    self.run(build_args, my_env)
  File "/Users/clementjoudet/dev/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.
```

All the build until 92% seems okay. When using USE_CUDA=0, or trying `install develop` I still get the same error

## Expected behavior

It should install without error.

## Environment

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Mac OSX 10.15.5
GCC version: Could not collect
CMake version: version 3.17.3

Python version: 3.7
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.18.1
[conda] Could not collect

## Additional context

Sorry if this is not the right place to ask. I thought that since only one particular file seems to have an issue, it had something to do with the file itself.

cc @malfet @ngimel