<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto">I installed pybind11 v2.3.0 systemwide (for fastText). PyTorch build system detects it, use it but then build fails.</p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Install pybind11 v2.3.0 system wide (distro used, Arch linux with the <a href="https://github.com/mratsim/Arch-Data-Science/blob/2739b1aa5bd1c955d15e9f8fd67087931bf623af/frameworks/python-pytorch-magma-mkldnn-cudnn-git/PKGBUILD#L38-L112">following build script<br>
</a><br>
The build will fail with sleef visibility issue:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ 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 &lt;sleef.h&gt;
          ^~~~~~~~~
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"><pre class="notranslate"><code class="notranslate">[ 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 &lt;sleef.h&gt;
          ^~~~~~~~~
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
</code></pre></div>
<p dir="auto">Rebuilding the same commit (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/pytorch/pytorch/commit/4444b9114125a7a7b79d941a54b68eabbbc36583/hovercard" href="https://github.com/pytorch/pytorch/commit/4444b9114125a7a7b79d941a54b68eabbbc36583"><tt>4444b91</tt></a>) without systemwide Pybind11 works</p>
<h2 dir="auto">Expected behavior</h2>

<p dir="auto">Successful build</p>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0): source</li>
<li>OS (e.g., Linux): Arch</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source): source</li>
<li>Build command you used (if compiling from source): <a href="https://github.com/mratsim/Arch-Data-Science/blob/2739b1aa5bd1c955d15e9f8fd67087931bf623af/frameworks/python-pytorch-magma-mkldnn-cudnn-git/PKGBUILD#L38-L112">https://github.com/mratsim/Arch-Data-Science/blob/2739b1aa5bd1c955d15e9f8fd67087931bf623af/frameworks/python-pytorch-magma-mkldnn-cudnn-git/PKGBUILD#L38-L112</a></li>
<li>Python version:</li>
<li>CUDA/cuDNN version:</li>
<li>GPU models and configuration:</li>
<li>Any other relevant information:</li>
</ul>
<h2 dir="auto">Additional context</h2>
<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>

<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<p dir="auto">1.<code class="notranslate">USE_NATIVE_ARCH=ON python setup.py install</code></p>

<h2 dir="auto">Expected behavior</h2>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 &lt;sleef.h&gt;
                   ^
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 &quot;setup.py&quot;, line 756, in &lt;module&gt;
    build_deps()
  File &quot;setup.py&quot;, line 321, in build_deps
    cmake=cmake)
  File &quot;/home/xiaobinz/Downloads/pytorch-xiaobing/tools/build_pytorch_libs.py&quot;, line 63, in build_caffe2
    cmake.build(my_env)
  File &quot;/home/xiaobinz/Downloads/pytorch-xiaobing/tools/setup_helpers/cmake.py&quot;, line 331, in build
    self.run(build_args, my_env)
  File &quot;/home/xiaobinz/Downloads/pytorch-xiaobing/tools/setup_helpers/cmake.py&quot;, line 142, in run
    check_call(command, cwd=self.build_dir, env=env)
  File &quot;/home/xiaobinz/anaconda3/envs/pytorch-test/lib/python3.6/subprocess.py&quot;, 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."><pre class="notranslate"><code class="notranslate">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 &lt;sleef.h&gt;
                   ^
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 &lt;module&gt;
    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.
</code></pre></div>
<h2 dir="auto">Environment</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" 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"><pre class="notranslate"><code class="notranslate"> 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
</code></pre></div>