CMake error during PyTorch Mobile custom build

Racek: <p>Hi!<br>
I’m trying to make custom build of PyTorch Mobile as in <a href="https://pytorch.org/mobile/android/#custom-build" rel="noopener nofollow ugc">Custom Build</a>. During build I’m facing this error:</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "C:/Users/Racek/android/PyTorch_binaries/pytorch/cmake/../aten/src/ATen/gen_vulkan_spv.py", line 8, in &lt;module&gt;
    from tools.codegen.code_template import CodeTemplate
ModuleNotFoundError: No module named 'tools'
CMake Error at cmake/VulkanCodegen.cmake:70 (message):
  Failed to gen spv.h and spv.cpp with precompiled shaders for Vulkan backend
Call Stack (most recent call first):
  caffe2/CMakeLists.txt:6 (include)
</code></pre>
<p>What I’ve did:</p>
<ul>
<li>cloned pytorch repo</li>
<li>set ANDROID_HOME env variable</li>
<li>installed android ndk via Android Studio and set ANDROID_NDK env variable</li>
<li>installed CMake 3.20.0 and added it to PATH</li>
</ul>
<p>full log:</p>
<pre><code class="lang-auto">+++ dirname pytorch/scripts/build_pytorch_android.sh
++ cd pytorch/scripts/..
++ pwd -P
+ PYTORCH_DIR=/c/Users/Racek/android/PyTorch_binaries/pytorch
+ PYTORCH_ANDROID_DIR=/c/Users/Racek/android/PyTorch_binaries/pytorch/android
+ echo PYTORCH_DIR:/c/Users/Racek/android/PyTorch_binaries/pytorch
PYTORCH_DIR:/c/Users/Racek/android/PyTorch_binaries/pytorch
+ source /c/Users/Racek/android/PyTorch_binaries/pytorch/android/common.sh
++ set -eux
++ '[' -z /c/Users/Racek/android/PyTorch_binaries/pytorch ']'
+ check_android_sdk
+ '[' -z 'C:\Users\Racek\AppData\Local\Android\Sdk' ']'
+ '[' '!' -d 'C:\Users\Racek\AppData\Local\Android\Sdk' ']'
+ echo 'ANDROID_HOME:C:\Users\Racek\AppData\Local\Android\Sdk'
ANDROID_HOME:C:\Users\Racek\AppData\Local\Android\Sdk
+ check_gradle
+ GRADLE_PATH=/c/Users/Racek/android/PyTorch_binaries/pytorch/android/gradlew
+ echo GRADLE_PATH:/c/Users/Racek/android/PyTorch_binaries/pytorch/android/gradlew
GRADLE_PATH:/c/Users/Racek/android/PyTorch_binaries/pytorch/android/gradlew
+ parse_abis_list arm64-v8a
+ ABIS_LIST=armeabi-v7a,arm64-v8a,x86,x86_64
+ CUSTOM_ABIS_LIST=false
+ '[' 1 -gt 0 ']'
+ ABIS_LIST=arm64-v8a
+ CUSTOM_ABIS_LIST=true
+ echo ABIS_LIST:arm64-v8a
ABIS_LIST:arm64-v8a
+ echo CUSTOM_ABIS_LIST:true
CUSTOM_ABIS_LIST:true
+ build_android
+ PYTORCH_ANDROID_DIR=/c/Users/Racek/android/PyTorch_binaries/pytorch/android
+ BUILD_ROOT=/c/Users/Racek/android/PyTorch_binaries/pytorch
+ echo BUILD_ROOT:/c/Users/Racek/android/PyTorch_binaries/pytorch
BUILD_ROOT:/c/Users/Racek/android/PyTorch_binaries/pytorch
+ LIB_DIR=/c/Users/Racek/android/PyTorch_binaries/pytorch/android/pytorch_android/src/main/jniLibs
+ INCLUDE_DIR=/c/Users/Racek/android/PyTorch_binaries/pytorch/android/pytorch_android/src/main/cpp/libtorch_include
+ rm -rf /c/Users/Racek/android/PyTorch_binaries/pytorch/android/pytorch_android/src/main/jniLibs
+ mkdir -p /c/Users/Racek/android/PyTorch_binaries/pytorch/android/pytorch_android/src/main/jniLibs
+ rm -rf /c/Users/Racek/android/PyTorch_binaries/pytorch/android/pytorch_android/src/main/cpp/libtorch_include
+ mkdir -p /c/Users/Racek/android/PyTorch_binaries/pytorch/android/pytorch_android/src/main/cpp/libtorch_include
++ echo arm64-v8a
++ tr , '\n'
+ for abi in $(echo "$ABIS_LIST" | tr ',' '\n')
+ echo abi:arm64-v8a
abi:arm64-v8a
+ ANDROID_BUILD_ROOT=/c/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a
++ which ccache
which: no ccache in (C:\Program Files\CMake\bin:C:\Users\Racek\AppData\Local\Android\Sdk\cmake\3.18.1\bin:/c/Users/Racek/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Racek/bin:/c/ProgramData/Anaconda3:/c/ProgramData/Anaconda3/Library/mingw-w64/bin:/c/ProgramData/Anaconda3/Library/usr/bin:/c/ProgramData/Anaconda3/Library/bin:/c/ProgramData/Anaconda3/Scripts:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/cmd:/c/Users/Racek/AppData/Local/Microsoft/WindowsApps:/c/Users/Racek/AppData/Local/atom/bin:/usr/bin/vendor_perl:/usr/bin/core_perl)
+ ANDROID_ABI=arm64-v8a
+ BUILD_ROOT=/c/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a
+ /c/Users/Racek/android/PyTorch_binaries/pytorch/scripts/build_android.sh -DANDROID_CCACHE=
Build with ANDROID_ABI[arm64-v8a], ANDROID_NATIVE_API_LEVEL[21]
Bash: GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
Python: 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Caffe2 path: /c/Users/Racek/android/PyTorch_binaries/pytorch
Using Android NDK at C:\Users\Racek\AppData\Local\Android\Sdk\ndk\23.0.7123448
Android NDK version: 23
Choose SELECTED_OP_LIST file: /c/Users/Racek/android/PyTorch_binaries/mobilenetv3_small_new.yaml
-- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The CXX compiler identification is Clang 11.0.5
-- The C compiler identification is Clang 11.0.5
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/Racek/AppData/Local/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/Racek/AppData/Local/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Not forcing any particular BLAS to be found
-- Performing Test CAFFE2_EXCEPTION_PTR_SUPPORTED
-- Performing Test CAFFE2_EXCEPTION_PTR_SUPPORTED - Success
-- std::exception_ptr is supported.
-- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING
-- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING - Failed
-- Turning off deprecation warning due to glog.
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS - Failed
-- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Trying to find preferred BLAS backend of choice: Eigen
CMake Error at cmake/Dependencies.cmake:337 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/pthreadpool

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:340 (set_property):
  set_property could not find TARGET pthreadpool.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:380 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/cpuinfo

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:385 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- The ASM compiler identification is Clang
-- Found assembler: C:/Users/Racek/AppData/Local/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:320 (add_subdirectory):
  add_subdirectory given source
  "C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/cpuinfo/deps/clog"
  which is not an existing directory.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:324 (set_property):
  set_property could not find TARGET clog.  Perhaps it has not yet been
  created.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:342 (add_subdirectory):
  The binary directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a/confu-deps/cpuinfo

  is already used to build a source directory.  It cannot be used to build
  source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/cpuinfo

  Specify a unique binary directory name.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:352 (add_subdirectory):
  The binary directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a/confu-deps/pthreadpool

  is already used to build a source directory.  It cannot be used to build
  source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/pthreadpool

  Specify a unique binary directory name.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:378 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/FXdiv

  does not contain a CMakeLists.txt file.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:393 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/psimd

  does not contain a CMakeLists.txt file.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:410 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/FP16

  does not contain a CMakeLists.txt file.


CMake Error at cmake/Dependencies.cmake:468 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- Brace yourself, we are building NNPACK
CMake Error at cmake/External/nnpack.cmake:71 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/NNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/External/nnpack.cmake:76 (set_property):
  set_property could not find TARGET nnpack.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/External/nnpack.cmake:77 (set_property):
  set_property could not find TARGET pthreadpool.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/External/nnpack.cmake:78 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:528 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/XNNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:532 (set_property):
  set_property could not find TARGET XNNPACK.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- VULKAN_INCLUDE_DIR:C:/Users/Racek/AppData/Local/Android/Sdk/ndk/23.0.7123448/sources/third-party/vulkan/src/include
-- Vulkan_ANDROID_NDK_WRAPPER_DIR:C:/Users/Racek/AppData/Local/Android/Sdk/ndk/23.0.7123448/sources/third_party/vulkan/src/common
CMake Warning at cmake/Dependencies.cmake:732 (message):
  Turning USE_FAKELOWP off as it depends on USE_FBGEMM.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:866 (add_subdirectory):
  The binary directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a/confu-deps/fp16

  is already used to build a source directory.  It cannot be used to build
  source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/FP16

  Specify a unique binary directory name.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- Using third party subdirectory Eigen.
-- Could NOT find pybind11 (missing: pybind11_DIR)
-- Could NOT find pybind11 (missing: pybind11_INCLUDE_DIR)
-- Using third_party/pybind11.
-- pybind11 include dirs: C:/Users/Racek/android/PyTorch_binaries/pytorch/cmake/../third_party/pybind11/include
CMake Warning at cmake/Dependencies.cmake:1263 (message):
  Not using CUDA/ROCM, so disabling USE_NCCL.  Suppress this warning with
  -DUSE_NCCL=OFF.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Warning at cmake/Dependencies.cmake:1383 (message):
  Metal is only used in ios builds.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:1779 (add_subdirectory):
  The source directory

    C:/Users/Racek/android/PyTorch_binaries/pytorch/third_party/fmt

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:1788 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  fmt-header-only
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- Not using libkineto in a mobile build.
-- Performing Test HAS_WERROR_FORMAT
-- Performing Test HAS_WERROR_FORMAT - Success
-- Performing Test HAS_WERROR_CAST_FUNCTION_TYPE
-- Performing Test HAS_WERROR_CAST_FUNCTION_TYPE - Success
-- Performing Test HAS_VST1
-- Performing Test HAS_VST1 - Success
-- Performing Test HAS_VLD1
-- Performing Test HAS_VLD1 - Success
-- Looking for backtrace
-- Looking for backtrace - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR)
-- don't use NUMA
INFOUse default op dependency graph .yaml file for custom build with dynamic dispatch.
-- Custom build with op registration whitelist: aten::Int;aten::_adaptive_avg_pool2d;aten::_addmv_impl_;aten::_batch_norm_impl_index;aten::_cat;aten::_coalesced_;aten::_convolution;aten::_convolution_nogroup;aten::_copy_from;aten::_empty_affine_quantized;aten::_empty_per_channel_affine_quantized;aten::_fused_dropout;aten::_indices;aten::_local_scalar_dense;aten::_make_per_tensor_quantized_tensor;aten::_mkldnn_reshape;aten::_mkldnn_transpose;aten::_mkldnn_transpose_;aten::_nnpack_available;aten::_nnpack_spatial_convolution;aten::_nnz;aten::_sparse_coo_tensor_with_dims_and_tensors;aten::_unsafe_view;aten::_values;aten::adaptive_avg_pool2d;aten::add;aten::add_;aten::addmm;aten::addmm_;aten::arange;aten::as_strided;aten::as_strided_;aten::baddbmm_;aten::batch_norm;aten::bernoulli_;aten::bmm;aten::cat;aten::clamp;aten::clamp_;aten::clamp_max;aten::clamp_min;aten::clamp_min_;aten::clone;aten::contiguous;aten::convolution_overrideable;aten::copy_;aten::copy_sparse_to_sparse_;aten::cudnn_batch_norm;aten::cudnn_convolution;aten::cudnn_convolution_transpose;aten::dense_dim;aten::dequantize;aten::detach;aten::div;aten::div_;aten::dot;aten::dropout;aten::empty;aten::empty_like;aten::empty_meta;aten::empty_strided;aten::eq;aten::equal;aten::expand;aten::fill_;aten::hardtanh_;aten::index_select;aten::int_repr;aten::is_coalesced;aten::is_floating_point;aten::is_leaf;aten::is_nonzero;aten::is_same_size;aten::item;aten::matmul;aten::max;aten::maximum;aten::mean;aten::min;aten::minimum;aten::miopen_batch_norm;aten::miopen_convolution;aten::miopen_convolution_transpose;aten::miopen_depthwise_convolution;aten::mkldnn_adaptive_avg_pool2d;aten::mm;aten::mul;aten::mul_;aten::mv;aten::narrow;aten::native_batch_norm;aten::ne;aten::nonzero;aten::ones;aten::permute;aten::q_per_channel_axis;aten::q_per_channel_scales;aten::q_per_channel_zero_points;aten::q_scale;aten::q_zero_point;aten::qscheme;aten::quantize_per_tensor;aten::relu_;aten::reshape;aten::resize_;aten::resize_as_;aten::select;aten::set_;aten::size;aten::slice;aten::slow_conv3d;aten::slow_conv3d_forward;aten::slow_conv_dilated2d;aten::slow_conv_dilated3d;aten::slow_conv_transpose2d;aten::slow_conv_transpose3d;aten::sparse_dim;aten::sparse_resize_and_clear_;aten::squeeze;aten::squeeze_;aten::sum;aten::t;aten::thnn_conv2d;aten::thnn_conv2d_forward;aten::thnn_conv_depthwise2d;aten::thnn_conv_depthwise2d_forward;aten::to;aten::transpose;aten::transpose_;aten::unsqueeze;aten::unsqueeze_;aten::view;aten::zero_;aten::zeros;aten::zeros_like;prim::NumToTensor

Traceback (most recent call last):
  File "C:/Users/Racek/android/PyTorch_binaries/pytorch/cmake/../aten/src/ATen/gen_vulkan_spv.py", line 8, in &lt;module&gt;
    from tools.codegen.code_template import CodeTemplate
ModuleNotFoundError: No module named 'tools'
CMake Error at cmake/VulkanCodegen.cmake:70 (message):
  Failed to gen spv.h and spv.cpp with precompiled shaders for Vulkan backend
Call Stack (most recent call first):
  caffe2/CMakeLists.txt:6 (include)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Racek/android/PyTorch_binaries/pytorch/build_android_arm64-v8a/CMakeFiles/CMakeError.log".
</code></pre>
<p>At this point I have no idea how to fix it. Can you help me? I can post CMakeError.log and CMakeOutput.log if needed.</p>

Racek: <p>So I’ve also tried it under ubuntu, and it seems that it went a bit further, but still no luck:</p>
<pre><code class="lang-auto">+++ dirname pytorch/scripts/build_pytorch_android.sh
++ cd pytorch/scripts/..
++ pwd -P
+ PYTORCH_DIR=/home/racek/Documents/pytorch
+ PYTORCH_ANDROID_DIR=/home/racek/Documents/pytorch/android
+ echo PYTORCH_DIR:/home/racek/Documents/pytorch
PYTORCH_DIR:/home/racek/Documents/pytorch
+ source /home/racek/Documents/pytorch/android/common.sh
++ set -eux
++ '[' -z /home/racek/Documents/pytorch ']'
+ check_android_sdk
+ '[' -z /home/racek/Android/Sdk ']'
+ '[' '!' -d /home/racek/Android/Sdk ']'
+ echo ANDROID_HOME:/home/racek/Android/Sdk
ANDROID_HOME:/home/racek/Android/Sdk
+ check_gradle
+ GRADLE_PATH=/home/racek/Documents/pytorch/android/gradlew
+ echo GRADLE_PATH:/home/racek/Documents/pytorch/android/gradlew
GRADLE_PATH:/home/racek/Documents/pytorch/android/gradlew
+ parse_abis_list arm64-v8a
+ ABIS_LIST=armeabi-v7a,arm64-v8a,x86,x86_64
+ CUSTOM_ABIS_LIST=false
+ '[' 1 -gt 0 ']'
+ ABIS_LIST=arm64-v8a
+ CUSTOM_ABIS_LIST=true
+ echo ABIS_LIST:arm64-v8a
ABIS_LIST:arm64-v8a
+ echo CUSTOM_ABIS_LIST:true
CUSTOM_ABIS_LIST:true
+ build_android
+ PYTORCH_ANDROID_DIR=/home/racek/Documents/pytorch/android
+ BUILD_ROOT=/home/racek/Documents/pytorch
+ echo BUILD_ROOT:/home/racek/Documents/pytorch
BUILD_ROOT:/home/racek/Documents/pytorch
+ LIB_DIR=/home/racek/Documents/pytorch/android/pytorch_android/src/main/jniLibs
+ INCLUDE_DIR=/home/racek/Documents/pytorch/android/pytorch_android/src/main/cpp/libtorch_include
+ rm -rf /home/racek/Documents/pytorch/android/pytorch_android/src/main/jniLibs
+ mkdir -p /home/racek/Documents/pytorch/android/pytorch_android/src/main/jniLibs
+ rm -rf /home/racek/Documents/pytorch/android/pytorch_android/src/main/cpp/libtorch_include
+ mkdir -p /home/racek/Documents/pytorch/android/pytorch_android/src/main/cpp/libtorch_include
++ echo arm64-v8a
++ tr , '\n'
+ for abi in $(echo "$ABIS_LIST" | tr ',' '\n')
+ echo abi:arm64-v8a
abi:arm64-v8a
+ ANDROID_BUILD_ROOT=/home/racek/Documents/pytorch/build_android_arm64-v8a
++ which ccache
+ ANDROID_ABI=arm64-v8a
+ BUILD_ROOT=/home/racek/Documents/pytorch/build_android_arm64-v8a
+ /home/racek/Documents/pytorch/scripts/build_android.sh -DANDROID_CCACHE=
Build with ANDROID_ABI[arm64-v8a], ANDROID_NATIVE_API_LEVEL[21]
Default python executable is Python-2, trying to use python3 alias
Bash: GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
Python: 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0]
Caffe2 path: /home/racek/Documents/pytorch
Using Android NDK at /home/racek/Android/Sdk/ndk/23.0.7123448
Android NDK version: 23
Choose SELECTED_OP_LIST file: /home/racek/Documents/mobilenetv3_small_new.yaml
-- std::exception_ptr is supported.
-- Turning off deprecation warning due to glog.
-- Trying to find preferred BLAS backend of choice: Eigen
CMake Error at cmake/Dependencies.cmake:337 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/pthreadpool

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:340 (set_property):
  set_property could not find TARGET pthreadpool.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:380 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/cpuinfo

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:385 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:320 (add_subdirectory):
  add_subdirectory given source
  "/home/racek/Documents/pytorch/third_party/cpuinfo/deps/clog" which is not
  an existing directory.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:324 (set_property):
  set_property could not find TARGET clog.  Perhaps it has not yet been
  created.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:342 (add_subdirectory):
  The binary directory

    /home/racek/Documents/pytorch/build_android_arm64-v8a/confu-deps/cpuinfo

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/racek/Documents/pytorch/third_party/cpuinfo

  Specify a unique binary directory name.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:352 (add_subdirectory):
  The binary directory

    /home/racek/Documents/pytorch/build_android_arm64-v8a/confu-deps/pthreadpool

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/racek/Documents/pytorch/third_party/pthreadpool

  Specify a unique binary directory name.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:378 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/FXdiv

  does not contain a CMakeLists.txt file.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:393 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/psimd

  does not contain a CMakeLists.txt file.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:410 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/FP16

  does not contain a CMakeLists.txt file.


CMake Error at cmake/Dependencies.cmake:468 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- Brace yourself, we are building NNPACK
CMake Error at cmake/External/nnpack.cmake:71 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/NNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/External/nnpack.cmake:76 (set_property):
  set_property could not find TARGET nnpack.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/External/nnpack.cmake:77 (set_property):
  set_property could not find TARGET pthreadpool.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/External/nnpack.cmake:78 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:498 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:528 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/XNNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:532 (set_property):
  set_property could not find TARGET XNNPACK.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- VULKAN_INCLUDE_DIR:/home/racek/Android/Sdk/ndk/23.0.7123448/sources/third-party/vulkan/src/include
-- Vulkan_ANDROID_NDK_WRAPPER_DIR:/home/racek/Android/Sdk/ndk/23.0.7123448/sources/third_party/vulkan/src/common
CMake Warning at cmake/Dependencies.cmake:732 (message):
  Turning USE_FAKELOWP off as it depends on USE_FBGEMM.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:866 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/FP16

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- Using third party subdirectory Eigen.
-- Using third_party/pybind11.
-- pybind11 include dirs: /home/racek/Documents/pytorch/cmake/../third_party/pybind11/include
CMake Error at cmake/Dependencies.cmake:1779 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/fmt

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


CMake Error at cmake/Dependencies.cmake:1788 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  fmt-header-only
Call Stack (most recent call first):
  CMakeLists.txt:603 (include)


-- Not using libkineto in a mobile build.
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) 
-- don't use NUMA
INFOUse default op dependency graph .yaml file for custom build with dynamic dispatch.
-- Custom build with op registration whitelist: aten::Int;aten::_adaptive_avg_pool2d;aten::_addmv_impl_;aten::_batch_norm_impl_index;aten::_cat;aten::_coalesced_;aten::_convolution;aten::_convolution_nogroup;aten::_copy_from;aten::_empty_affine_quantized;aten::_empty_per_channel_affine_quantized;aten::_fused_dropout;aten::_indices;aten::_local_scalar_dense;aten::_make_per_tensor_quantized_tensor;aten::_mkldnn_reshape;aten::_mkldnn_transpose;aten::_mkldnn_transpose_;aten::_nnpack_available;aten::_nnpack_spatial_convolution;aten::_nnz;aten::_sparse_coo_tensor_with_dims_and_tensors;aten::_unsafe_view;aten::_values;aten::adaptive_avg_pool2d;aten::add;aten::add_;aten::addmm;aten::addmm_;aten::arange;aten::as_strided;aten::as_strided_;aten::baddbmm_;aten::batch_norm;aten::bernoulli_;aten::bmm;aten::cat;aten::clamp;aten::clamp_;aten::clamp_max;aten::clamp_min;aten::clamp_min_;aten::clone;aten::contiguous;aten::convolution_overrideable;aten::copy_;aten::copy_sparse_to_sparse_;aten::cudnn_batch_norm;aten::cudnn_convolution;aten::cudnn_convolution_transpose;aten::dense_dim;aten::dequantize;aten::detach;aten::div;aten::div_;aten::dot;aten::dropout;aten::empty;aten::empty_like;aten::empty_meta;aten::empty_strided;aten::eq;aten::equal;aten::expand;aten::fill_;aten::hardtanh_;aten::index_select;aten::int_repr;aten::is_coalesced;aten::is_floating_point;aten::is_leaf;aten::is_nonzero;aten::is_same_size;aten::item;aten::matmul;aten::max;aten::maximum;aten::mean;aten::min;aten::minimum;aten::miopen_batch_norm;aten::miopen_convolution;aten::miopen_convolution_transpose;aten::miopen_depthwise_convolution;aten::mkldnn_adaptive_avg_pool2d;aten::mm;aten::mul;aten::mul_;aten::mv;aten::narrow;aten::native_batch_norm;aten::ne;aten::nonzero;aten::ones;aten::permute;aten::q_per_channel_axis;aten::q_per_channel_scales;aten::q_per_channel_zero_points;aten::q_scale;aten::q_zero_point;aten::qscheme;aten::quantize_per_tensor;aten::relu_;aten::reshape;aten::resize_;aten::resize_as_;aten::select;aten::set_;aten::size;aten::slice;aten::slow_conv3d;aten::slow_conv3d_forward;aten::slow_conv_dilated2d;aten::slow_conv_dilated3d;aten::slow_conv_transpose2d;aten::slow_conv_transpose3d;aten::sparse_dim;aten::sparse_resize_and_clear_;aten::squeeze;aten::squeeze_;aten::sum;aten::t;aten::thnn_conv2d;aten::thnn_conv2d_forward;aten::thnn_conv_depthwise2d;aten::thnn_conv_depthwise2d_forward;aten::to;aten::transpose;aten::transpose_;aten::unsqueeze;aten::unsqueeze_;aten::view;aten::zero_;aten::zeros;aten::zeros_like;prim::NumToTensor

hFilePath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/ATen/native/vulkan/spv.h cppFilePath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/ATen/native/vulkan/spv.cpp srcDirPath:/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl glslcPath:/home/racek/Android/Sdk/ndk/23.0.7123448/shader-tools/linux-x86_64/glslc tmpDirPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv
templateSrcPaths:['/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/KO4C4HW_to_image.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/adaptive_avg_pool2d.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/add.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/add_.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/add_scalar.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/add_scalar_.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/addmm.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/avg_pool2d.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/clamp.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/clamp_.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/conv2d.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/conv2d_dw.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/conv2d_dw_clamp.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/conv2d_nogroup_clamp.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/conv2d_nogroup_clamp_1x.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/conv2d_pw.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/image_to_nchw.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/max_pool2d.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/mean.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/mean2d.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/mm.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/mul_scalar.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/mul_scalar_.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/nchw_to_image.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/permute.glsl', '/home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/upsample_nearest2d.glsl']
templateSrcPath /home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/KO4C4HW_to_image.glsl
name KO4C4HW_to_image
spvPath /home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/KO4C4HW_to_image.spv

glslc cmd: ['/home/racek/Android/Sdk/ndk/23.0.7123448/shader-tools/linux-x86_64/glslc', '-fshader-stage=compute', '/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/KO4C4HW_to_image.glsl', '-o', '/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/KO4C4HW_to_image.spv', '--target-env=vulkan1.0', '-Werror']
templateSrcPath /home/racek/Documents/pytorch/cmake/../aten/src/ATen/native/vulkan/glsl/adaptive_avg_pool2d.glsl
name adaptive_avg_pool2d
spvPath /home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/adaptive_avg_pool2d.spv

// here goes a lot of similar paragraphs like the one above that I connot post bc of character limit //

glslc cmd: ['/home/racek/Android/Sdk/ndk/23.0.7123448/shader-tools/linux-x86_64/glslc', '-fshader-stage=compute', '/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/upsample_nearest2d.glsl', '-o', '/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/upsample_nearest2d.spv', '--target-env=vulkan1.0', '-Werror']
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/KO4C4HW_to_image.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/adaptive_avg_pool2d.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/add.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/add_.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/add_scalar.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/add_scalar_.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/addmm.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/avg_pool2d.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/clamp.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/clamp_.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/conv2d.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/conv2d_dw.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/conv2d_dw_clamp.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/conv2d_nogroup_clamp.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/conv2d_nogroup_clamp_1x.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/conv2d_pw.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/image_to_nchw.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/max_pool2d.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/mean.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/mean2d.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/mm.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/mul_scalar.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/mul_scalar_.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/nchw_to_image.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/permute.spv
spvPath:/home/racek/Documents/pytorch/build_android_arm64-v8a/vulkan/spv/upsample_nearest2d.spv
-- Using ATen parallel backend: NATIVE
disabling CUDA because USE_CUDA is set false
AT_INSTALL_INCLUDE_DIR include/ATen/core
core header install: /home/racek/Documents/pytorch/build_android_arm64-v8a/aten/src/ATen/core/TensorBody.h
CMake Error at caffe2/CMakeLists.txt:112 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/FXdiv

  does not contain a CMakeLists.txt file.


CMake Warning at CMakeLists.txt:894 (message):
  Generated cmake files are only fully tested if one builds with system glog,
  gflags, and protobuf.  Other settings may generate files that are not well
  tested.


CMake Warning at CMakeLists.txt:946 (message):
  Generated cmake files are only available when building shared libs.


-- 
-- ******** Summary ********
-- General:
--   CMake version         : 3.19.6
--   CMake command         : /home/racek/cmake/bin/cmake
--   System                : Android
--   C++ compiler          : /home/racek/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
--   C++ compiler id       : Clang
--   C++ compiler version  : 11.0.5
--   CXX flags             : -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions  -DNO_EXPORT -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN -DUSE_VULKAN_API -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-invalid-partial-specialization -Wno-typedef-redefinition -Wno-unknown-warning-option -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-aligned-allocation-unavailable -Wno-c++14-extensions -Wno-constexpr-not-const -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -g0
--   Build type            : Release
--   Compile definitions   : 
--   CMAKE_PREFIX_PATH     : /usr/lib/python3/dist-packages;/home/racek/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/linux-x86_64
--   CMAKE_INSTALL_PREFIX  : /home/racek/Documents/pytorch/build_android_arm64-v8a/install
-- 
--   TORCH_VERSION         : 1.9.0
--   CAFFE2_VERSION        : 1.9.0
--   BUILD_CAFFE2          : ON
--   BUILD_CAFFE2_OPS      : OFF
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_TENSOREXPR_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : OFF
--     Protobuf compiler   : 
--     Protobuf includes   : 
--     Protobuf libraries  : 
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : OFF
--   BUILD_SHARED_LIBS     : OFF
--   CAFFE2_USE_MSVC_STATIC_RUNTIME     : ON
--   BUILD_TEST            : OFF
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   BUILD_LITE_INTERPRETER: OFF
--   INTERN_BUILD_MOBILE   : ON
--   USE_BLAS              : 1
--     BLAS                : 
--   USE_LAPACK            : 
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : OFF
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : ON
--   USE_FBGEMM            : OFF
--     USE_FAKELOWP          : OFF
--   USE_KINETO            : OFF
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_PYTORCH_METAL     : OFF
--   USE_FFTW              : OFF
--   USE_MKL               : 
--   USE_MKLDNN            : OFF
--   USE_NCCL              : OFF
--   USE_NNPACK            : ON
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : OFF
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : OFF
--   USE_TBB               : OFF
--   USE_VULKAN            : ON
--     USE_VULKAN_FP16_INFERENCE    : OFF
--     USE_VULKAN_RELAXED_PRECISION : OFF
--     USE_VULKAN_SHADERC_RUNTIME   : OFF
--     USE_VULKAN_WRAPPER           : ON
--   USE_PROF              : OFF
--   USE_QNNPACK           : OFF
--   USE_PYTORCH_QNNPACK   : ON
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : OFF
--   SELECTED_OP_LIST    : /home/racek/Documents/mobilenetv3_small_new.yaml
--   USE_DEPLOY           : OFF
--   Public Dependencies  : Threads::Threads
--   Private Dependencies : eigen_blas;pthreadpool;cpuinfo;pytorch_qnnpack;XNNPACK;VulkanWrapper;fp16;log;fmt::fmt-header-only;dl
-- Configuring incomplete, errors occurred!
See also "/home/racek/Documents/pytorch/build_android_arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "/home/racek/Documents/pytorch/build_android_arm64-v8a/CMakeFiles/CMakeError.log".
</code></pre>
<p>At this point I don’t even get traceback to any particular error, however there is a lot of CMake errors like this:</p>
<pre><code class="lang-auto">CMake Error at cmake/Dependencies.cmake:1779 (add_subdirectory):
  The source directory

    /home/racek/Documents/pytorch/third_party/fmt

  does not contain a CMakeLists.txt file.
</code></pre>
<p>but I don’t know whethet it is intended. Ofc I can also post CMakeOutput.log and CMakeError.log if needed.</p>

IvanKobzarev: <p><a class="mention" href="/u/racek">@Racek</a> ,<br>
Looks like submodules were not synced.<br>
Did you do</p>
<pre><code class="lang-auto">git submodule update --init --recursive
</code></pre>
<p>after cloning?</p>

Racek: <p><a class="mention" href="/u/ivankobzarev">@IvanKobzarev</a> So this was the case with this error - thanks!</p>
<p>It took me a little further, but I still have problem with Vulkan:</p>
<pre><code class="lang-auto">-- 
-- ******** Summary ********
-- General:
--   CMake version         : 3.19.6
--   CMake command         : /home/racek/cmake/bin/cmake
--   System                : Android
--   C++ compiler          : /home/racek/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
--   C++ compiler id       : Clang
--   C++ compiler version  : 11.0.5
--   CXX flags             : -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions  -DNO_EXPORT -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN -DUSE_VULKAN_API -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-invalid-partial-specialization -Wno-typedef-redefinition -Wno-unknown-warning-option -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-aligned-allocation-unavailable -Wno-c++14-extensions -Wno-constexpr-not-const -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -g0
--   Build type            : Release
--   Compile definitions   : 
--   CMAKE_PREFIX_PATH     : /usr/lib/python3/dist-packages;/home/racek/Android/Sdk/ndk/23.0.7123448/toolchains/llvm/prebuilt/linux-x86_64
--   CMAKE_INSTALL_PREFIX  : /home/racek/Documents/pytorch/build_android_arm64-v8a/install
-- 
--   TORCH_VERSION         : 1.9.0
--   CAFFE2_VERSION        : 1.9.0
--   BUILD_CAFFE2          : ON
--   BUILD_CAFFE2_OPS      : OFF
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_TENSOREXPR_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : OFF
--     Protobuf compiler   : 
--     Protobuf includes   : 
--     Protobuf libraries  : 
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : OFF
--   BUILD_SHARED_LIBS     : OFF
--   CAFFE2_USE_MSVC_STATIC_RUNTIME     : ON
--   BUILD_TEST            : OFF
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   BUILD_LITE_INTERPRETER: OFF
--   INTERN_BUILD_MOBILE   : ON
--   USE_BLAS              : 1
--     BLAS                : 
--   USE_LAPACK            : 
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : OFF
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : ON
--   USE_FBGEMM            : OFF
--     USE_FAKELOWP          : OFF
--   USE_KINETO            : OFF
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_PYTORCH_METAL     : OFF
--   USE_FFTW              : OFF
--   USE_MKL               : 
--   USE_MKLDNN            : OFF
--   USE_NCCL              : OFF
--   USE_NNPACK            : ON
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : OFF
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : OFF
--   USE_TBB               : OFF
--   USE_VULKAN            : ON
--     USE_VULKAN_FP16_INFERENCE    : OFF
--     USE_VULKAN_RELAXED_PRECISION : OFF
--     USE_VULKAN_SHADERC_RUNTIME   : OFF
--     USE_VULKAN_WRAPPER           : ON
--   USE_PROF              : OFF
--   USE_QNNPACK           : OFF
--   USE_PYTORCH_QNNPACK   : ON
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : OFF
--   SELECTED_OP_LIST    : /home/racek/Documents/mobilenetv3_small_new.yaml
--   USE_DEPLOY           : OFF
--   Public Dependencies  : Threads::Threads
--   Private Dependencies : eigen_blas;pthreadpool;cpuinfo;pytorch_qnnpack;nnpack;XNNPACK;VulkanWrapper;fp16;log;fmt::fmt-header-only;dl
-- Configuring done
CMake Error at cmake/VulkanDependencies.cmake:18 (add_library):
  Cannot find source file:

    /home/racek/Android/Sdk/ndk/23.0.7123448/sources/third_party/vulkan/src/common/vulkan_wrapper.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc
Call Stack (most recent call first):
  cmake/Dependencies.cmake:559 (include)
  CMakeLists.txt:603 (include)


CMake Error at cmake/VulkanDependencies.cmake:18 (add_library):
  No SOURCES given to target: VulkanWrapper
Call Stack (most recent call first):
  cmake/Dependencies.cmake:559 (include)
  CMakeLists.txt:603 (include)


CMake Generate step failed.  Build files cannot be regenerated correctly.

</code></pre>
<p>Acutally there is no /vulkan/src/common/ directory at all.<br>
Do you have an idea how to handle this?</p>

SergioSanchezMontesU: <p>Same problem here. Any progress on solving this?</p>

Paran0: <p>For me the issue resolved after syncing the submodule:</p>
<pre><code class="lang-auto">Bash: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Python: 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0]
Caffe2 path: /mnt/media/Linux/pytorch/pytorch
Using Android NDK at /home/parano/Android/Sdk/ndk/21.3.6528147
Android NDK version: 21
-- std::exception_ptr is supported.
-- Turning off deprecation warning due to glog.
-- Trying to find preferred BLAS backend of choice: Eigen
-- Brace yourself, we are building NNPACK
-- NNPACK backend is neon
-- VULKAN_INCLUDE_DIR:/home/parano/Android/Sdk/ndk/21.3.6528147/sources/third_party/vulkan/src/include
-- Vulkan_ANDROID_NDK_WRAPPER_DIR:/home/parano/Android/Sdk/ndk/21.3.6528147/sources/third_party/vulkan/src/common
CMake Warning at cmake/Dependencies.cmake:780 (message):
  Turning USE_FAKELOWP off as it depends on USE_FBGEMM.
Call Stack (most recent call first):
  CMakeLists.txt:637 (include)


-- Using third party subdirectory Eigen.
-- Using third_party/pybind11.
-- pybind11 include dirs: /mnt/media/Linux/pytorch/pytorch/cmake/../third_party/pybind11/include
-- Version: 7.0.3
-- Build type: Release
-- CXX_STANDARD: 14
-- Required features: cxx_variadic_templates
-- Not using libkineto in a mobile build.
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) 
-- don't use NUMA

</code></pre>
<p>Can you try with different NDK version? It seems your problem have something todo with the NDK, also make sure the vulkan development libraries are fully installed.</p>
<p>Here is my CMAKE summary:</p>
<pre><code class="lang-auto">-- 
-- ******** Summary ********
-- General:
--   CMake version         : 3.16.3
--   CMake command         : /usr/bin/cmake
--   System                : Android
--   C++ compiler          : /home/parano/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
--   C++ compiler id       : Clang
--   C++ compiler version  : 9.0
--   Using ccache if found : ON
--   Found ccache          : /usr/bin/ccache
--   CXX flags             : -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -frtti -fexceptions  -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DUSE_VULKAN_WRAPPER -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN -DUSE_VULKAN_API -DBUILD_LITE_INTERPRETER -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-invalid-partial-specialization -Wno-typedef-redefinition -Wno-unknown-warning-option -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-aligned-allocation-unavailable -Wno-c++14-extensions -Wno-constexpr-not-const -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -g0
--   Build type            : Release
--   Compile definitions   : 
--   CMAKE_PREFIX_PATH     : /usr/lib/python3.8/site-packages;/home/parano/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64
--   CMAKE_INSTALL_PREFIX  : /mnt/media/Linux/pytorch/pytorch/build_android_armeabi-v7a/install
--   USE_GOLD_LINKER       : OFF
-- 
--   TORCH_VERSION         : 1.10.0
--   CAFFE2_VERSION        : 1.10.0
--   BUILD_CAFFE2          : ON
--   BUILD_CAFFE2_OPS      : OFF
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_TENSOREXPR_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : OFF
--     Protobuf compiler   : 
--     Protobuf includes   : 
--     Protobuf libraries  : 
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : OFF
--   BUILD_SHARED_LIBS     : OFF
--   CAFFE2_USE_MSVC_STATIC_RUNTIME     : ON
--   BUILD_TEST            : OFF
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   BUILD_LITE_INTERPRETER: ON
--   INTERN_BUILD_MOBILE   : ON
--   USE_BLAS              : 1
--     BLAS                : 
--   USE_LAPACK            : 0
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : OFF
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : ON
--   USE_FBGEMM            : OFF
--     USE_FAKELOWP          : OFF
--   USE_KINETO            : OFF
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_PYTORCH_METAL     : OFF
--   USE_FFTW              : OFF
--   USE_MKL               : 
--   USE_MKLDNN            : OFF
--   USE_NCCL              : OFF
--   USE_NNPACK            : ON
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : OFF
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : OFF
--   USE_TBB               : OFF
--   USE_VULKAN            : ON
--     USE_VULKAN_FP16_INFERENCE    : OFF
--     USE_VULKAN_RELAXED_PRECISION : OFF
--     USE_VULKAN_SHADERC_RUNTIME   : OFF
--   USE_PROF              : OFF
--   USE_QNNPACK           : OFF
--   USE_PYTORCH_QNNPACK   : ON
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : OFF
--   USE_DEPLOY           : OFF
--   Public Dependencies  : Threads::Threads
--   Private Dependencies : eigen_blas;pthreadpool;cpuinfo;pytorch_qnnpack;nnpack;XNNPACK;VulkanWrapper;fp16;log;fmt::fmt-header-only;dl
-- Configuring done
-- Generating done
</code></pre>

Bhavul: <p>I can confirm what <a class="mention" href="/u/paran0">@Paran0</a> suggested works. Changing the NDK version to 21.3.X worked for me, while it was failing for version 23.X.</p>

Ali_Karimi: <p>The same thing happened to me. I tried different versions of the NDK. Using NDK 24 or 23, I was getting the same Vulkan error. But, building with <a href="https://github.com/android/ndk/wiki/Unsupported-Downloads#r21e" rel="noopener nofollow ugc">NDK r21e</a> was successful.<br>
BTW, this is my <a href="https://drive.google.com/file/d/1cGxgFDRETCCSTZWVyHI5O6V1BObgaikP/view?usp=sharing" rel="noopener nofollow ugc"><code>build_android/install/bin/speed_benchmark_torch</code></a> file (unzip it).</p>

scheckmedia: <p>Hi everyone,<br>
I was facing the same issue some days ago with NDK 23, PyTorch 1.12.0 and the following might help. As I could read in the <a href="https://github.com/android/ndk/wiki/Changelog-r23" rel="noopener nofollow ugc">NDK changelog</a>:</p>
<blockquote>
<p>Vulkan tools source is also removed, specifically vulkan_wrapper. It should be downloaded upstream from GitHub.</p>
</blockquote>
<p>it is required to manually place the <code>common</code> folder from the <a href="https://github.com/KhronosGroup/Vulkan-Tools" rel="noopener nofollow ugc">Vulkan-Tools repository</a> (v1.2.137 worked for me)  into the Android NDK Vulkan folder (NDK/sources/third_party/vulkan). If you use libtorch on mobile it might be necessary to copy two missing source files: pytorchdir/aten/src/ATen/native/PadNd.* → compiled_abi_dir/include/ATen/native/ to build an app that uses libtorch.</p>