<p dir="auto">I cannot install Caffe2 on Nvidia TX2 because of such error:</p>
<p dir="auto">Scanning dependencies of target operator_fallback_gpu_test<br>
[ 80%] Building CXX object caffe2/CMakeFiles/operator_fallback_gpu_test.dir/operators/operator_fallback_gpu_          test.cc.o<br>
[ 80%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state.cc.o<br>
[ 80%] Building CXX object caffe2/CMakeFiles/reshape_op_gpu_test.dir/operators/reshape_op_gpu_test.cc.o<br>
[ 80%] Building CXX object caffe2/CMakeFiles/elementwise_op_gpu_test.dir/operators/elementwise_op_gpu_test.c          c.o<br>
[ 80%] Linking CXX executable ../bin/reshape_op_gpu_test<br>
../lib/libcaffe2_gpu.so: undefined reference to <code class="notranslate">void caffe2::math::BiasCHW&lt;float, caffe2::CUDAContext&gt;(floa          t const*, int, int, float*, caffe2::CUDAContext*)' collect2: error: ld returned 1 exit status caffe2/CMakeFiles/reshape_op_gpu_test.dir/build.make:109: recipe for target 'bin/reshape_op_gpu_test' failed make[2]: *** [bin/reshape_op_gpu_test] Error 1 CMakeFiles/Makefile2:1587: recipe for target 'caffe2/CMakeFiles/reshape_op_gpu_test.dir/all' failed make[1]: *** [caffe2/CMakeFiles/reshape_op_gpu_test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 80%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_dlpack.cc.o [ 80%] Linking CXX executable ../bin/operator_fallback_gpu_test ../lib/libcaffe2_gpu.so: undefined reference to </code>void caffe2::math::BiasCHW&lt;float, caffe2::CUDAContext&gt;(floa          t const*, int, int, float*, caffe2::CUDAContext*)'<br>
collect2: error: ld returned 1 exit status<br>
caffe2/CMakeFiles/operator_fallback_gpu_test.dir/build.make:109: recipe for target 'bin/operator_fallback_gp          u_test' failed<br>
make[2]: *** [bin/operator_fallback_gpu_test] Error 1<br>
CMakeFiles/Makefile2:1671: recipe for target 'caffe2/CMakeFiles/operator_fallback_gpu_test.dir/all' failed<br>
make[1]: *** [caffe2/CMakeFiles/operator_fallback_gpu_test.dir/all] Error 2<br>
[ 80%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_gpu.cc.o<br>
[ 80%] Linking CXX executable ../bin/elementwise_op_gpu_test<br>
../lib/libcaffe2_gpu.so: undefined reference to `void caffe2::math::BiasCHW&lt;float, caffe2::CUDAContext&gt;(floa          t const*, int, int, float*, caffe2::CUDAContext*)'<br>
collect2: error: ld returned 1 exit status<br>
caffe2/CMakeFiles/elementwise_op_gpu_test.dir/build.make:109: recipe for target 'bin/elementwise_op_gpu_test          ' failed<br>
make[2]: *** [bin/elementwise_op_gpu_test] Error 1<br>
CMakeFiles/Makefile2:1629: recipe for target 'caffe2/CMakeFiles/elementwise_op_gpu_test.dir/all' failed<br>
make[1]: *** [caffe2/CMakeFiles/elementwise_op_gpu_test.dir/all] Error 2<br>
[ 80%] Linking CXX shared module python/caffe2_pybind11_state_gpu.so<br>
[ 80%] Built target caffe2_pybind11_state_gpu<br>
Makefile:138: recipe for target 'all' failed<br>
make: *** [all] Error 2</p>
<p dir="auto">Would someone give me any help? I have been stuck on installation for a long time!</p>
<ul dir="auto">
<li>PyTorch or Caffe2: C2</li>
<li>How you installed PyTorch (conda, pip, source): source</li>
<li>Build command you used (if compiling from source):  ./build_tegra_x1.sh</li>
<li>OS: Ubuntu 16.04</li>
<li>PyTorch version:</li>
<li>Python version: 2.7</li>
<li>CUDA/cuDNN version:  cuda9.0 cudnn7.0.5</li>
<li>GPU models and configuration: Nvidia TX2</li>
<li>GCC version (if compiling from source): gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609</li>
<li>CMake version: 3.5.1</li>
<li>Versions of any other relevant libraries:</li>
</ul>
<h2 dir="auto">🐛 Bug</h2>
<p dir="auto">PyTorch fails to finish building, with a possible bug (see below).</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Scanning dependencies of target caffe2_observers
[ 92%] Building CXX object caffe2/torch/lib/THD/CMakeFiles/THD.dir/base/data_channels/DataChannelTCP.cpp.o
[ 93%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/net_observer_reporter_print.cc.o
�[91m/opt/pytorch/torch/lib/c10d/ProcessGroupMPI.cpp: In destructor ‘virtual c10d::ProcessGroupMPI::AsyncWork::~AsyncWork()’:
/opt/pytorch/torch/lib/c10d/ProcessGroupMPI.cpp:154:71: error: throw will always call terminate() [-Werror=terminate]
         &quot;Attempted destruction of AsyncWork before work has completed&quot;);
                                                                       ^
/opt/pytorch/torch/lib/c10d/ProcessGroupMPI.cpp:154:71: note: in C++11 destructors default to noexcept
�[0m[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/function.cpp.o
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/accumulate_grad.cpp.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/ps_roi_pool_op.cc.o
[ 93%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/observer_config.cc.o
�[91mcc1plus: all warnings being treated as errors
�[0m�[91mmake[2]: *** [caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/ProcessGroupMPI.cpp.o] Error 1
�[0m�[91mmake[2]: *** Waiting for unfinished jobs....
�[0mcaffe2/torch/lib/c10d/CMakeFiles/c10d.dir/build.make:230: recipe for target 'caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/ProcessGroupMPI.cpp.o' failed
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/basic_ops.cpp.o
[ 93%] Building CXX object caffe2/torch/lib/THD/CMakeFiles/THD.dir/base/init_methods/InitMethod.cpp.o
[ 93%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/perf_observer.cc.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/roi_pool_f_op.cc.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/sample_as_op.cc.o
[ 93%] Building CXX object caffe2/torch/lib/THD/CMakeFiles/THD.dir/base/init_methods/InitMethodEnv.cpp.o
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/comm.cpp.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/select_smooth_l1_loss_op.cc.o
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/tensor.cpp.o
CMakeFiles/Makefile2:7496: recipe for target 'caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/all' failed
�[91mmake[1]: *** [caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/all] Error 2
�[0m�[91mmake[1]: *** Waiting for unfinished jobs....
...
...
...
[ 99%] Linking CXX shared library ../../lib/libtorch.so
[ 99%] Built target torch
Makefile:138: recipe for target 'all' failed
�[91mmake: *** [all] Error 2
�[0msetup.py::build_deps::run()
Failed to run 'bash ../tools/build_pytorch_libs.sh --use-fbgemm --use-nnpack --use-mkldnn --use-qnnpack caffe2'"><pre class="notranslate">Scanning dependencies of target caffe2_observers
[ 92%] Building CXX object caffe2/torch/lib/THD/CMakeFiles/THD.dir/base/data_channels/DataChannelTCP.cpp.o
[ 93%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/net_observer_reporter_print.cc.o
�[91m/opt/pytorch/torch/lib/c10d/ProcessGroupMPI.cpp: In destructor ‘virtual <span class="pl-en">c10d::ProcessGroupMPI::AsyncWork::~AsyncWork</span>()’:
/opt/pytorch/torch/lib/c10d/ProcessGroupMPI.cpp:154:71: error: throw will always call <span class="pl-en">terminate</span>() [-Werror<span class="pl-k">=</span>terminate]
         <span class="pl-s"><span class="pl-pds">"</span>Attempted destruction of AsyncWork before work has completed<span class="pl-pds">"</span></span>)<span class="pl-k">;</span>
                                                                       ^
/opt/pytorch/torch/lib/c10d/ProcessGroupMPI.cpp:154:71: note: <span class="pl-k">in</span> C++11 destructors default to noexcept
�[0m[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/function.cpp.o
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/accumulate_grad.cpp.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/ps_roi_pool_op.cc.o
[ 93%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/observer_config.cc.o
�[91mcc1plus: all warnings being treated as errors
�[0m�[91mmake[2]: <span class="pl-k">***</span> [caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/ProcessGroupMPI.cpp.o] Error 1
�[0m�[91mmake[2]: <span class="pl-k">***</span> Waiting <span class="pl-k">for</span> unfinished jobs....
�[0mcaffe2/torch/lib/c10d/CMakeFiles/c10d.dir/build.make:230: recipe <span class="pl-k">for</span> target <span class="pl-s"><span class="pl-pds">'</span>caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/ProcessGroupMPI.cpp.o<span class="pl-pds">'</span></span> failed
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/basic_ops.cpp.o
[ 93%] Building CXX object caffe2/torch/lib/THD/CMakeFiles/THD.dir/base/init_methods/InitMethod.cpp.o
[ 93%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/perf_observer.cc.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/roi_pool_f_op.cc.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/sample_as_op.cc.o
[ 93%] Building CXX object caffe2/torch/lib/THD/CMakeFiles/THD.dir/base/init_methods/InitMethodEnv.cpp.o
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/comm.cpp.o
[ 93%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/select_smooth_l1_loss_op.cc.o
[ 93%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/functions/tensor.cpp.o
CMakeFiles/Makefile2:7496: recipe <span class="pl-k">for</span> target <span class="pl-s"><span class="pl-pds">'</span>caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/all<span class="pl-pds">'</span></span> failed
�[91mmake[1]: <span class="pl-k">***</span> [caffe2/torch/lib/c10d/CMakeFiles/c10d.dir/all] Error 2
�[0m�[91mmake[1]: <span class="pl-k">***</span> Waiting <span class="pl-k">for</span> unfinished jobs....
...
...
...
[ 99%] Linking CXX shared library ../../lib/libtorch.so
[ 99%] Built target torch
Makefile:138: recipe <span class="pl-k">for</span> target <span class="pl-s"><span class="pl-pds">'</span>all<span class="pl-pds">'</span></span> failed
�[91mmake: <span class="pl-k">***</span> [all] Error 2
<span class="pl-en">�[0msetup.py::build_deps::run</span>()
Failed to run <span class="pl-s"><span class="pl-pds">'</span>bash ../tools/build_pytorch_libs.sh --use-fbgemm --use-nnpack --use-mkldnn --use-qnnpack caffe2<span class="pl-pds">'</span></span></pre></div>
<h2 dir="auto">To Reproduce</h2>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" cd /opt &amp;&amp; git clone --recursive https://github.com/pytorch/pytorch \
    &amp;&amp; cd pytorch &amp;&amp; git submodule update --init &amp;&amp; \
    cd /opt/pytorch/third_party/ideep/mkl-dnn &amp;&amp; \
    git pull https://github.com/intel/mkl-dnn.git --no-commit  --rebase &amp;&amp; \
    cd /opt/pytorch &amp;&amp; \
    sed -i 's/&quot;Use MKLDNN&quot; OFF/&quot;Use MKLDNN&quot; ON /g' CMakeLists.txt &amp;&amp; \
    sed -i 's/&quot;Use DISTRIBUTED&quot; OFF/&quot;Use DISTRIBUTED&quot; ON /g' CMakeLists.txt &amp;&amp; \
    sed -i 's/for parallel code&quot; OFF/for parallel code&quot; ON /g' CMakeLists.txt &amp;&amp; \
    PYTHON_EXECUTABLE=/opt/conda/bin/python \
    PYTHON_LIBRARY=/opt/conda/lib/libpython3.6m.so \
    PYTHON_INCLUDE_DIR=/opt/conda/include/python3.6m \
    FULL_CAFFE2=1 \
    USE_OPENMP=1 \
    USE_MKL=1 \
    USE_MKLDNN=1 \
    USE_MKLML=1 \
    USE_SYSTEM_EIGEN_INSTALL=1 \
    USE_ZMQ=1 \
    USE_DISTRIBUTED=1 \
    MKLDNN_LIBRARY=/usr/local/lib \
    MKLDNN_INCLUDE_DIR=/usr/local/include \
    MKLDNN_LIB_DIR=/usr/local/lib \
    python setup.py install &amp;&amp; \
    cd /opt &amp;&amp; rm -rf /opt/pytorch &amp;&amp; \
    cd /usr/lib &amp;&amp; sudo ldconfig"><pre class="notranslate"> <span class="pl-c1">cd</span> /opt <span class="pl-k">&amp;&amp;</span> git clone --recursive https://github.com/pytorch/pytorch \
    <span class="pl-k">&amp;&amp;</span> <span class="pl-c1">cd</span> pytorch <span class="pl-k">&amp;&amp;</span> git submodule update --init <span class="pl-k">&amp;&amp;</span> \
    <span class="pl-c1">cd</span> /opt/pytorch/third_party/ideep/mkl-dnn <span class="pl-k">&amp;&amp;</span> \
    git pull https://github.com/intel/mkl-dnn.git --no-commit  --rebase <span class="pl-k">&amp;&amp;</span> \
    <span class="pl-c1">cd</span> /opt/pytorch <span class="pl-k">&amp;&amp;</span> \
    sed -i <span class="pl-s"><span class="pl-pds">'</span>s/"Use MKLDNN" OFF/"Use MKLDNN" ON /g<span class="pl-pds">'</span></span> CMakeLists.txt <span class="pl-k">&amp;&amp;</span> \
    sed -i <span class="pl-s"><span class="pl-pds">'</span>s/"Use DISTRIBUTED" OFF/"Use DISTRIBUTED" ON /g<span class="pl-pds">'</span></span> CMakeLists.txt <span class="pl-k">&amp;&amp;</span> \
    sed -i <span class="pl-s"><span class="pl-pds">'</span>s/for parallel code" OFF/for parallel code" ON /g<span class="pl-pds">'</span></span> CMakeLists.txt <span class="pl-k">&amp;&amp;</span> \
    PYTHON_EXECUTABLE=/opt/conda/bin/python \
    PYTHON_LIBRARY=/opt/conda/lib/libpython3.6m.so \
    PYTHON_INCLUDE_DIR=/opt/conda/include/python3.6m \
    FULL_CAFFE2=1 \
    USE_OPENMP=1 \
    USE_MKL=1 \
    USE_MKLDNN=1 \
    USE_MKLML=1 \
    USE_SYSTEM_EIGEN_INSTALL=1 \
    USE_ZMQ=1 \
    USE_DISTRIBUTED=1 \
    MKLDNN_LIBRARY=/usr/local/lib \
    MKLDNN_INCLUDE_DIR=/usr/local/include \
    MKLDNN_LIB_DIR=/usr/local/lib \
    python setup.py install <span class="pl-k">&amp;&amp;</span> \
    <span class="pl-c1">cd</span> /opt <span class="pl-k">&amp;&amp;</span> rm -rf /opt/pytorch <span class="pl-k">&amp;&amp;</span> \
    <span class="pl-c1">cd</span> /usr/lib <span class="pl-k">&amp;&amp;</span> sudo ldconfig</pre></div>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0): Master branch (1.0)</li>
<li>OS (e.g., Linux): Debian:Stretch</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): see above</li>
<li>Python version: 3.6</li>
<li>CUDA/cuDNN version: N/A</li>
<li>GPU models and configuration: N/A</li>
<li>Any other relevant information: N/A</li>
</ul>
<h2 dir="auto">Additional context</h2>