Fuse Module Recipe tutorial error - PyTorch Mobile

Hello folks,

I am following this tutorial. https://pytorch.org/tutorials/recipes/fuse.html

When I try to build the module, I get an error.

3. Build the Android benchmark Tool

Get the PyTorch source and build the Android benchmark tool as follows:

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
git submodule update --init --recursive
BUILD_PYTORCH_MOBILE=1 ANDROID_ABI=arm64-v8a ./scripts/build_android.sh -DBUILD_BINARY=ON

Since the shall script could not find Android NDK, I manually set them a correct path.

eugene.roh@IB-LT-42721 MINGW64 ~/pytorch (master)
$ ANDROID_NDK="C:\Users\eugene.roh\AppData\Local\Android\Sdk\ndk\23.1.7779620" BUILD_PYTORCH_MOBILE=1 ANDROID_ABI=arm64-v8a ./scripts/build_android.sh -DBUILD_BINARY=ON
Bash: GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
Python: 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
Caffe2 path: /c/Users/eugene.roh/pytorch
Using Android NDK at C:\Users\eugene.roh\AppData\Local\Android\Sdk\ndk\23.1.7779620
Android NDK version: 23
-- ANDROID_PLATFORM not set. Defaulting to minimum supported version 16.
-- android-16 is not supported for arm64-v8a. Using minimum supported LP64 version 21.
-- Android: Selected unified Clang toolchain
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Users/eugene.roh/AppData/Local/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: C:/Users/eugene.roh/AppData/Local/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/eugene.roh/pytorch/build_android/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_57be6.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.1+3e40a09f8 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,5): error MSB8020: The build tools for Clang_5_0 (Platform Toolset = 'Clang_5_0') cannot be found. To build using the Clang_5_0 build tools, please install Clang_5_0 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\eugene.roh\pytorch\build_android\CMakeFiles\CMakeTmp\cmTC_57be6.vcxproj]

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:23 (project)

-- Configuring incomplete, errors occurred!
See also "C:/Users/eugene.roh/pytorch/build_android/CMakeFiles/CMakeOutput.log".
See also "C:/Users/eugene.roh/pytorch/build_android/CMakeFiles/CMakeError.log".

I guess I am having a problem with locating C++ compiler. How should I solve this problem?

Hi @dalseeroh, please check the notes in the build script pytorch/build_android.sh at master · pytorch/pytorch · GitHub
and make sure all steps are done.
Also check
配置 CMake  |  Android 开发者  |  Android Developers
for cmake configs.