Issue 1:
🐛 Bug

I installed pybind11 v2.3.0 systemwide (for fastText). PyTorch build system detects it, use it but then build fails.

To Reproduce

Install pybind11 v2.3.0 system wide (distro used, Arch linux with the following build script

The build will fail with sleef visibility issue:

[ 83%] Building CXX object caffe2/CMakeFiles/thread_init_test.dir/__/aten/src/ATen/test/thread_init_test.cpp.o
[ 83%] Building CXX object caffe2/CMakeFiles/cuda_tensor_interop_test.dir/__/aten/src/ATen/test/cuda_tensor_interop_test.cpp.o
[ 83%] Building CXX object caffe2/CMakeFiles/tensor_iterator_test.dir/__/aten/src/ATen/test/tensor_iterator_test.cpp.o
[ 83%] Building CXX object caffe2/CMakeFiles/native_test.dir/__/aten/src/ATen/test/native_test.cpp.o
[ 83%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state.cc.o
[ 83%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state.cc.o
In file included from /pkg/makepkg/buildpkg/python-pytorch-magma-mkldnn-cudnn-git/src/pytorch/aten/src/ATen/cpu/vec256/vec256.h:6,
from /pkg/makepkg/buildpkg/python-pytorch-magma-mkldnn-cudnn-git/src/pytorch/aten/src/ATen/native/cpu/Loops.h:34,
from /pkg/makepkg/buildpkg/python-pytorch-magma-mkldnn-cudnn-git/src/pytorch/aten/src/ATen/test/tensor_iterator_test.cpp:6:
/pkg/makepkg/buildpkg/python-pytorch-magma-mkldnn-cudnn-git/src/pytorch/aten/src/ATen/cpu/vec256/vec256_float.h:6:10: fatal error: sleef.h: No such file or directory
#include <sleef.h>
^~~~~~~~~
compilation terminated.
make[2]: *** [caffe2/CMakeFiles/tensor_iterator_test.dir/build.make:63: caffe2/CMakeFiles/tensor_iterator_test.dir/__/aten/src/ATen/test/tensor_iterator_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3877: caffe2/CMakeFiles/tensor_iterator_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 83%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state_dlpack.cc.o
[ 83%] Linking CXX executable ../bin/fatal_signal_asan_no_sig_test
[ 83%] Built target fatal_signal_asan_no_sig_test

Rebuilding the same commit (4444b91) without systemwide Pybind11 works

Expected behavior

Successful build

Environment

PyTorch Version (e.g., 1.0): source

OS (e.g., Linux): Arch

How you installed PyTorch (conda, pip, source): source

Build command you used (if compiling from source): https://github.com/mratsim/Arch-Data-Science/blob/2739b1aa5bd1c955d15e9f8fd67087931bf623af/frameworks/python-pytorch-magma-mkldnn-cudnn-git/PKGBUILD#L38-L112

Python version:

CUDA/cuDNN version:

GPU models and configuration:

Any other relevant information:

Additional context

Issue 2:
🐛 Bug

To Reproduce

Steps to reproduce the behavior:

1.USE_NATIVE_ARCH=ON python setup.py install

Expected behavior

caffe2/CMakeFiles/tensor_iterator_test.dir/__/aten/src/ATen/test/tensor_iterator_test.cpp.o -c ../aten/src/ATen/test/tensor_iterator_test.cpp
In file included from ../aten/src/ATen/cpu/vec256/vec256.h:6:0,
from ../aten/src/ATen/native/cpu/Loops.h:34,
from ../aten/src/ATen/test/tensor_iterator_test.cpp:6:
../aten/src/ATen/cpu/vec256/vec256_float.h:6:19: fatal error: sleef.h: No such file or directory
#include <sleef.h>
^
compilation terminated.
[1508/2705] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state.cc.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "setup.py", line 756, in <module>
build_deps()
File "setup.py", line 321, in build_deps
cmake=cmake)
File "/home/xiaobinz/Downloads/pytorch-xiaobing/tools/build_pytorch_libs.py", line 63, in build_caffe2
cmake.build(my_env)
File "/home/xiaobinz/Downloads/pytorch-xiaobing/tools/setup_helpers/cmake.py", line 331, in build
self.run(build_args, my_env)
File "/home/xiaobinz/Downloads/pytorch-xiaobing/tools/setup_helpers/cmake.py", line 142, in run
check_call(command, cwd=self.build_dir, env=env)
File "/home/xiaobinz/anaconda3/envs/pytorch-test/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '112']' returned non-zero exit status 1.

Environment

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: CentOS Linux 7 (Core)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
CMake version: version 3.14.0

Python version: 3.6
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:
[pip] numpy==1.16.5
[conda] blas 1.0 mkl
[conda] mkl 2019.4 243
[conda] mkl-include 2019.4 243
[conda] mkl-service 2.3.0 py36he904b0f_0
[conda] mkl_fft 1.0.14 py36ha843d7b_0
[conda] mkl_random 1.0.2 py36hd81dba3_0