Failed to build Pytorch audio from source

with the following ERROR messages:

[  3%] Building CXX object torchaudio/csrc/CMakeFiles/libtorchaudio_decoder.dir/decoder/src/decoder/lm/KenLM.cpp.o
cd ....../pytorch/audio/build/torchaudio/csrc && /usr/local/bin/c++ -DBUILD_CTC_DECODER -DINCLUDE_KALDI -DINCLUDE_SOX -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_RPC -DUSE_TENSORPIPE -Dlibtorchaudio_decoder_EXPORTS -I....../pytorch/audio -isystem /usr/local/include/torch/csrc/api/include -isystem /usr/local/cuda/include -I/usr/local/include/kenlm -Wall -D_GLIBCXX_USE_CXX11_ABI=1 -O3 -DNDEBUG -fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -MD -MT torchaudio/csrc/CMakeFiles/libtorchaudio_decoder.dir/decoder/src/decoder/lm/KenLM.cpp.o -MF CMakeFiles/libtorchaudio_decoder.dir/decoder/src/decoder/lm/KenLM.cpp.o.d -o CMakeFiles/libtorchaudio_decoder.dir/decoder/src/decoder/lm/KenLM.cpp.o -c ....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp
In file included from /usr/local/include/kenlm/lm/model.hh:8,
                 from ....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp:15:
/usr/local/include/kenlm/lm/quantize.hh:228:18: error: ‘KENLM_MAX_ORDER’ was not declared in this scope; did you mean ‘LM_MAX_ORDER_H’?
  228 |     Bins tables_[KENLM_MAX_ORDER - 1][2];
      |                  ^~~~~~~~~~~~~~~
      |                  LM_MAX_ORDER_H
/usr/local/include/kenlm/lm/quantize.hh: In member function ‘const lm::ngram::SeparatelyQuantize::Bins* lm::ngram::SeparatelyQuantize::GetTables(unsigned char) const’:
/usr/local/include/kenlm/lm/quantize.hh:223:71: error: ‘tables_’ was not declared in this scope
  223 |     const Bins *GetTables(unsigned char order_minus_2) const { return tables_[order_minus_2]; }
      |                                                                       ^~~~~~~
In file included from /usr/local/include/kenlm/lm/model.hh:11,
                 from ....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp:15:
/usr/local/include/kenlm/lm/state.hh: At global scope:
/usr/local/include/kenlm/lm/state.hh:45:21: error: ‘KENLM_MAX_ORDER’ was not declared in this scope; did you mean ‘LM_MAX_ORDER_H’?
   45 |     WordIndex words[KENLM_MAX_ORDER - 1];
      |                     ^~~~~~~~~~~~~~~
      |                     LM_MAX_ORDER_H
/usr/local/include/kenlm/lm/state.hh:46:19: error: ‘KENLM_MAX_ORDER’ was not declared in this scope; did you mean ‘LM_MAX_ORDER_H’?
   46 |     float backoff[KENLM_MAX_ORDER - 1];
      |                   ^~~~~~~~~~~~~~~
      |                   LM_MAX_ORDER_H
In file included from /usr/local/include/kenlm/lm/model.hh:11,
                 from ....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp:15:
/usr/local/include/kenlm/lm/state.hh: In member function ‘bool lm::ngram::State::operator==(const lm::ngram::State&) const’:
/usr/local/include/kenlm/lm/state.hh:19:22: error: ‘words’ was not declared in this scope
   19 |       return !memcmp(words, other.words, length * sizeof(WordIndex));
      |                      ^~~~~
/usr/local/include/kenlm/lm/state.hh:19:35: error: ‘const class lm::ngram::State’ has no member named ‘words’
   19 |       return !memcmp(words, other.words, length * sizeof(WordIndex));
      |                                   ^~~~~
/usr/local/include/kenlm/lm/state.hh: In member function ‘int lm::ngram::State::Compare(const lm::ngram::State&) const’:
/usr/local/include/kenlm/lm/state.hh:25:21: error: ‘words’ was not declared in this scope
   25 |       return memcmp(words, other.words, length * sizeof(WordIndex));
      |                     ^~~~~
/usr/local/include/kenlm/lm/state.hh:25:34: error: ‘const class lm::ngram::State’ has no member named ‘words’
   25 |       return memcmp(words, other.words, length * sizeof(WordIndex));
      |                                  ^~~~~
/usr/local/include/kenlm/lm/state.hh: In member function ‘bool lm::ngram::State::operator<(const lm::ngram::State&) const’:
/usr/local/include/kenlm/lm/state.hh:30:21: error: ‘words’ was not declared in this scope
   30 |       return memcmp(words, other.words, length * sizeof(WordIndex)) < 0;
      |                     ^~~~~
/usr/local/include/kenlm/lm/state.hh:30:34: error: ‘const class lm::ngram::State’ has no member named ‘words’
   30 |       return memcmp(words, other.words, length * sizeof(WordIndex)) < 0;
      |                                  ^~~~~
/usr/local/include/kenlm/lm/state.hh: In member function ‘void lm::ngram::State::ZeroRemaining()’:
/usr/local/include/kenlm/lm/state.hh:35:42: error: ‘KENLM_MAX_ORDER’ was not declared in this scope; did you mean ‘LM_MAX_ORDER_H’?
   35 |       for (unsigned char i = length; i < KENLM_MAX_ORDER - 1; ++i) {
      |                                          ^~~~~~~~~~~~~~~
      |                                          LM_MAX_ORDER_H
/usr/local/include/kenlm/lm/state.hh:36:9: error: ‘words’ was not declared in this scope
   36 |         words[i] = 0;
      |         ^~~~~
/usr/local/include/kenlm/lm/state.hh:37:9: error: ‘backoff’ was not declared in this scope; did you mean ‘acosf’?
   37 |         backoff[i] = 0.0;
      |         ^~~~~~~
      |         acosf
In file included from /usr/local/include/kenlm/lm/model.hh:11,
                 from ....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp:15:
/usr/local/include/kenlm/lm/state.hh: In function ‘uint64_t lm::ngram::hash_value(const lm::ngram::State&, uint64_t)’:
/usr/local/include/kenlm/lm/state.hh:53:39: error: ‘const class lm::ngram::State’ has no member named ‘words’
   53 |   return util::MurmurHashNative(state.words, sizeof(WordIndex) * state.length, seed);
      |                                       ^~~~~
/usr/local/include/kenlm/lm/state.hh: At global scope:
/usr/local/include/kenlm/lm/state.hh:81:21: error: ‘KENLM_MAX_ORDER’ was not declared in this scope; did you mean ‘LM_MAX_ORDER_H’?
   81 |   uint64_t pointers[KENLM_MAX_ORDER - 1];
      |                     ^~~~~~~~~~~~~~~
      |                     LM_MAX_ORDER_H
/usr/local/include/kenlm/lm/state.hh: In member function ‘bool lm::ngram::Left::operator==(const lm::ngram::Left&) const’:
/usr/local/include/kenlm/lm/state.hh:60:20: error: ‘pointers’ was not declared in this scope
   60 |       (!length || (pointers[length - 1] == other.pointers[length - 1] && full == other.full));
      |                    ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh:60:50: error: ‘const struct lm::ngram::Left’ has no member named ‘pointers’
   60 |       (!length || (pointers[length - 1] == other.pointers[length - 1] && full == other.full));
      |                                                  ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh: In member function ‘int lm::ngram::Left::Compare(const lm::ngram::Left&) const’:
/usr/local/include/kenlm/lm/state.hh:67:9: error: ‘pointers’ was not declared in this scope
   67 |     if (pointers[length - 1] > other.pointers[length - 1]) return 1;
      |         ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh:67:38: error: ‘const struct lm::ngram::Left’ has no member named ‘pointers’
   67 |     if (pointers[length - 1] > other.pointers[length - 1]) return 1;
      |                                      ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh:68:9: error: ‘pointers’ was not declared in this scope
   68 |     if (pointers[length - 1] < other.pointers[length - 1]) return -1;
      |         ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh:68:38: error: ‘const struct lm::ngram::Left’ has no member named ‘pointers’
   68 |     if (pointers[length - 1] < other.pointers[length - 1]) return -1;
      |                                      ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh: In member function ‘void lm::ngram::Left::ZeroRemaining()’:
/usr/local/include/kenlm/lm/state.hh:77:25: error: ‘pointers’ was not declared in this scope
   77 |     for (uint64_t * i = pointers + length; i < pointers + KENLM_MAX_ORDER - 1; ++i)
      |                         ^~~~~~~~
/usr/local/include/kenlm/lm/state.hh:77:59: error: ‘KENLM_MAX_ORDER’ was not declared in this scope; did you mean ‘LM_MAX_ORDER_H’?
   77 |     for (uint64_t * i = pointers + length; i < pointers + KENLM_MAX_ORDER - 1; ++i)
      |                                                           ^~~~~~~~~~~~~~~
      |                                                           LM_MAX_ORDER_H
/usr/local/include/kenlm/lm/state.hh: In function ‘uint64_t lm::ngram::hash_value(const lm::ngram::Left&)’:
/usr/local/include/kenlm/lm/state.hh:90:60: error: ‘const struct lm::ngram::Left’ has no member named ‘pointers’
   90 |   return util::MurmurHashNative(add, 2, left.length ? left.pointers[left.length - 1] : 0);
      |                                                            ^~~~~~~~
....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp: In constructor ‘torchaudio::lib::text::KenLM::KenLM(const string&, const torchaudio::lib::text::Dictionary&)’:
....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp:37:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   37 |   for (int i = 0; i < usrTknDict.indexSize(); i++) {
      |                   ~~^~~~~~~~~~~~~~~~~~~~~~~~
....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp: In member function ‘virtual std::pair<std::shared_ptr<torchaudio::lib::text::LMState>, float> torchaudio::lib::text::KenLM::score(const LMStatePtr&, int)’:
....../pytorch/audio/torchaudio/csrc/decoder/src/decoder/lm/KenLM.cpp:58:38: warning: comparison of integer expressions of different signedness: ‘const int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   58 |   if (usrTokenIdx < 0 || usrTokenIdx >= usrToLmIdxMap_.size()) {
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [torchaudio/csrc/CMakeFiles/libtorchaudio_decoder.dir/build.make:121: torchaudio/csrc/CMakeFiles/libtorchaudio_decoder.dir/decoder/src/decoder/lm/KenLM.cpp.o] Error 1
make[2]: Leaving directory '....../pytorch/audio/build'
make[1]: *** [CMakeFiles/Makefile2:129: torchaudio/csrc/CMakeFiles/libtorchaudio_decoder.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '....../pytorch/audio/build'
make  -f torchaudio/csrc/CMakeFiles/libtorchaudio.dir/build.make torchaudio/csrc/CMakeFiles/libtorchaudio.dir/build
make[2]: Entering directory '....../pytorch/audio/build'
[  7%] Building CXX object torchaudio/csrc/CMakeFiles/libtorchaudio.dir/kaldi.cpp.o
cd ....../pytorch/audio/build/torchaudio/csrc && /usr/local/bin/c++ -DINCLUDE_KALDI -DINCLUDE_SOX -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_RPC -DUSE_TENSORPIPE -Dlibtorchaudio_EXPORTS -I....../pytorch/audio -isystem /usr/local/include/torch/csrc/api/include -isystem /usr/local/cuda/include -I/usr/local/include/kenlm -Wall -D_GLIBCXX_USE_CXX11_ABI=1 -O3 -DNDEBUG -fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -MD -MT torchaudio/csrc/CMakeFiles/libtorchaudio.dir/kaldi.cpp.o -MF CMakeFiles/libtorchaudio.dir/kaldi.cpp.o.d -o CMakeFiles/libtorchaudio.dir/kaldi.cpp.o -c ....../pytorch/audio/torchaudio/csrc/kaldi.cpp
....../pytorch/audio/torchaudio/csrc/kaldi.cpp:2:10: fatal error: feat/pitch-functions.h: No such file or directory
    2 | #include "feat/pitch-functions.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [torchaudio/csrc/CMakeFiles/libtorchaudio.dir/build.make:219: torchaudio/csrc/CMakeFiles/libtorchaudio.dir/kaldi.cpp.o] Error 1
make[2]: Leaving directory '....../pytorch/audio/build'
make[1]: *** [CMakeFiles/Makefile2:103: torchaudio/csrc/CMakeFiles/libtorchaudio.dir/all] Error 2
make[1]: Leaving directory '....../pytorch/audio/build'
make: *** [Makefile:139: all] Error 2

Hi @jiapei100, it seems like the kaldi submodule is missing. Could you try the following command to see if it works?

python setup.py clean
git pull
python setup.py install
1 Like

Hi, @nateanl Thank you, but:

The problem is NOT as easy as that:

➜  pytorch git:(master) ✗ python setup.py clean
Building wheel torch-1.12.0a0+git5a89753
running clean
➜  pytorch git:(master) ✗ python setup.py build
Building wheel torch-1.12.0a0+git5a89753
-- Building version 1.12.0a0+git5a89753
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=......pytorch/torch -DCMAKE_PREFIX_PATH=/usr/lib/python3.8/site-packages -DCUDA_NVCC_EXECUTABLE=/usr/local/cuda/bin/nvcc -DCUDNN_INCLUDE_DIR=/usr/local/cuda/include -DCUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so -DJAVA_HOME=/usr/lib/jvm/default-java -DNUMPY_INCLUDE_DIR=~/.local/lib/python3.8/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/usr/bin/python -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 -DPYTHON_LIBRARY=/usr/lib/libpython3.8.so.1.0 -DTORCH_BUILD_VERSION=1.12.0a0+git5a89753 -DUSE_NUMPY=True ......pytorch
-- The CXX compiler identification is GNU 10.3.1
-- The C compiler identification is GNU 10.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++ - 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: /usr/local/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Not forcing any particular BLAS to be found
CMake Warning (dev) at ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/CMakeDependentOption.cmake:84 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  CMakeLists.txt:252 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/CMakeDependentOption.cmake:84 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  CMakeLists.txt:287 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test COMPILER_WORKS
-- Performing Test COMPILER_WORKS - Success
-- Performing Test SUPPORT_GLIBCXX_USE_C99
-- Performing Test SUPPORT_GLIBCXX_USE_C99 - Success
-- 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 - Success
-- Performing Test C_HAS_AVX_1
-- Performing Test C_HAS_AVX_1 - Failed
-- Performing Test C_HAS_AVX_2
-- Performing Test C_HAS_AVX_2 - Success
-- Performing Test C_HAS_AVX2_1
-- Performing Test C_HAS_AVX2_1 - Failed
-- Performing Test C_HAS_AVX2_2
-- Performing Test C_HAS_AVX2_2 - Success
-- Performing Test C_HAS_AVX512_1
-- Performing Test C_HAS_AVX512_1 - Failed
-- Performing Test C_HAS_AVX512_2
-- Performing Test C_HAS_AVX512_2 - Success
-- Performing Test CXX_HAS_AVX_1
-- Performing Test CXX_HAS_AVX_1 - Failed
-- Performing Test CXX_HAS_AVX_2
-- Performing Test CXX_HAS_AVX_2 - Success
-- Performing Test CXX_HAS_AVX2_1
-- Performing Test CXX_HAS_AVX2_1 - Failed
-- Performing Test CXX_HAS_AVX2_2
-- Performing Test CXX_HAS_AVX2_2 - Success
-- Performing Test CXX_HAS_AVX512_1
-- Performing Test CXX_HAS_AVX512_1 - Failed
-- Performing Test CXX_HAS_AVX512_2
-- Performing Test CXX_HAS_AVX512_2 - Success
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS - Success
-- Current compiler supports avx512f extension. Will build fbgemm.
-- 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
-- Found CUDA: /usr/local/cuda (found version "11.5") 
-- The CUDA compiler identification is NVIDIA 11.5.119
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Caffe2: CUDA detected: 11.5
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 11.5
-- Found CUDNN: /usr/local/cuda/lib64/libcudnn.so  
-- Found cuDNN: v8.3.2  (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so)
-- /usr/local/cuda/lib64/libnvrtc.so shorthash is 65f2c18b
-- Autodetected CUDA architecture(s):  7.5
-- Added CUDA NVCC flags for: -gencode;arch=compute_75,code=sm_75
-- Building using own protobuf under third_party per request.
-- Use custom protobuf build.
-- 
-- 3.13.0.0
-- 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  
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Caffe2 protobuf include directory: $<BUILD_INTERFACE:......pytorch/third_party/protobuf/src>$<INSTALL_INTERFACE:include>
-- Trying to find preferred BLAS backend of choice: MKL
-- MKL_THREADING = OMP
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- MKL_THREADING = OMP
CMake Warning at cmake/Dependencies.cmake:221 (message):
  MKL could not be found.  Defaulting to Eigen
Call Stack (most recent call first):
  CMakeLists.txt:683 (include)


CMake Warning at cmake/Dependencies.cmake:254 (message):
  Preferred BLAS (MKL) cannot be found, now searching for a general BLAS
  library
Call Stack (most recent call first):
  CMakeLists.txt:683 (include)


-- MKL_THREADING = OMP
-- Checking for [mkl_intel_lp64 - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf_lp64 - mkl_intel_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_gf - mkl_intel_thread - mkl_core - gomp - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_intel_lp64 - mkl_gnu_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_gnu_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_gnu_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf_lp64 - mkl_intel_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_gnu_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_gf - mkl_intel_thread - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_intel_lp64 - mkl_gnu_thread - mkl_core - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_gnu_thread - mkl_core - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_gnu_thread - mkl_core - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf_lp64 - mkl_intel_thread - mkl_core - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_gnu_thread - mkl_core - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_gf - mkl_intel_thread - mkl_core - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_sequential - mkl_core - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_sequential - mkl_core - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_intel_lp64 - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_core - gomp - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_core - gomp - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_core - gomp - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_intel_lp64 - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_core - iomp5 - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl_intel_lp64 - mkl_core - pthread - m - dl]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_core - pthread - m - dl]
--   Library mkl_intel: not found
-- Checking for [mkl_gf_lp64 - mkl_core - pthread - m - dl]
--   Library mkl_gf_lp64: not found
-- Checking for [mkl_gf - mkl_core - pthread - m - dl]
--   Library mkl_gf: not found
-- Checking for [mkl - guide - pthread - m]
--   Library mkl: not found
-- MKL library not found
-- Checking for [blis]
--   Library blis: BLAS_blis_LIBRARY-NOTFOUND
-- Checking for [Accelerate]
--   Library Accelerate: BLAS_Accelerate_LIBRARY-NOTFOUND
-- Checking for [vecLib]
--   Library vecLib: BLAS_vecLib_LIBRARY-NOTFOUND
-- Checking for [flexiblas]
--   Library flexiblas: BLAS_flexiblas_LIBRARY-NOTFOUND
-- Checking for [openblas]
--   Library openblas: /usr/lib/x86_64-linux-gnu/libopenblas.so
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Performing Test BLAS_F2C_DOUBLE_WORKS
-- Performing Test BLAS_F2C_DOUBLE_WORKS - Failed
-- Performing Test BLAS_F2C_FLOAT_WORKS
-- Performing Test BLAS_F2C_FLOAT_WORKS - Success
-- Performing Test BLAS_USE_CBLAS_DOT
-- Performing Test BLAS_USE_CBLAS_DOT - Success
-- Looking for sbgemm_
-- Looking for sbgemm_ - not found
-- Found a library with BLAS API (open). Full path: (/usr/lib/x86_64-linux-gnu/libopenblas.so)
-- Using pocketfft in directory: ......pytorch/third_party/pocketfft/
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/bin/cc
-- Brace yourself, we are building NNPACK
-- Performing Test NNPACK_ARCH_IS_X86_32
-- Performing Test NNPACK_ARCH_IS_X86_32 - Failed
-- Found PythonInterp: /usr/bin/python (found version "3.8.10") 
-- NNPACK backend is x86-64
-- Found Python: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter 
-- LLVM FileCheck Found: /usr/lib/llvm/bin/FileCheck
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- git version: v1.5.5 normalized to 1.5.5
-- Version: 1.5.5
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test COMPILER_SUPPORTS_AVX512
-- Performing Test COMPILER_SUPPORTS_AVX512 - Success
CMake Warning (dev) at ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:576 (find_package_handle_standard_args)
  third_party/fbgemm/CMakeLists.txt:61 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found OpenMP_C: -fopenmp (found version "4.5") 
CMake Warning (dev) at ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:576 (find_package_handle_standard_args)
  third_party/fbgemm/CMakeLists.txt:61 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
CMake Warning at third_party/fbgemm/CMakeLists.txt:63 (message):
  OpenMP found! OpenMP_C_INCLUDE_DIRS =


CMake Warning at third_party/fbgemm/CMakeLists.txt:162 (message):
  ==========


CMake Warning at third_party/fbgemm/CMakeLists.txt:163 (message):
  CMAKE_BUILD_TYPE = Release


CMake Warning at third_party/fbgemm/CMakeLists.txt:164 (message):
  CMAKE_CXX_FLAGS_DEBUG is -g


CMake Warning at third_party/fbgemm/CMakeLists.txt:165 (message):
  CMAKE_CXX_FLAGS_RELEASE is -O3 -DNDEBUG


CMake Warning at third_party/fbgemm/CMakeLists.txt:166 (message):
  ==========


-- Performing Test __CxxFlag__fno_threadsafe_statics
-- Performing Test __CxxFlag__fno_threadsafe_statics - Success
-- Performing Test __CxxFlag__fno_semantic_interposition
-- Performing Test __CxxFlag__fno_semantic_interposition - Success
-- Performing Test __CxxFlag__fmerge_all_constants
-- Performing Test __CxxFlag__fmerge_all_constants - Success
-- Performing Test __CxxFlag__fno_enforce_eh_specs
-- Performing Test __CxxFlag__fno_enforce_eh_specs - Success
** AsmJit Summary **
   ASMJIT_DIR=......pytorch/third_party/fbgemm/third_party/asmjit
   ASMJIT_TEST=FALSE
   ASMJIT_TARGET_TYPE=STATIC
   ASMJIT_DEPS=pthread;rt
   ASMJIT_LIBS=asmjit;pthread;rt
   ASMJIT_CFLAGS=-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS=-Wall;-Wextra;-Wconversion;-fno-math-errno;-fno-threadsafe-statics;-fno-semantic-interposition;-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS_DBG=
   ASMJIT_PRIVATE_CFLAGS_REL=-O2;-fmerge-all-constants;-fno-enforce-eh-specs
-- Found Numa: /usr/include  
-- Found Numa  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libnuma.so)
-- Using third party subdirectory Eigen.
-- Found PythonInterp: /usr/bin/python (found suitable version "3.8.10", minimum required is "3.0") 
-- Found PythonLibs: /usr/lib/libpython3.8.so.1.0 (found suitable version "3.8.10", minimum required is "3.0") 
-- Using third_party/pybind11.
-- pybind11 include dirs: ......pytorch/cmake/../third_party/pybind11/include
CMake Error in ......pytorch/build/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Imported target "MPI::MPI_C" includes non-existent path

    "......pytorch/I_MPI_SUBSTITUTE_INSTALLDIR/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error at ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindMPI.cmake:1264 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindMPI.cmake:1315 (_MPI_try_staged_settings)
  ~/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindMPI.cmake:1638 (_MPI_check_lang_works)
  cmake/Dependencies.cmake:1127 (find_package)
  CMakeLists.txt:683 (include)


-- Configuring incomplete, errors occurred!
See also "......pytorch/build/CMakeFiles/CMakeOutput.log".
See also "......pytorch/build/CMakeFiles/CMakeError.log".

I see. Thanks for posting the log info. From what I see, you are trying to build PyTorch from source and “MPI” package is not found. You can try install libopenmpi-dev and build it again.

Another workaround is installing PyTorch via conda or pip, then build torchaudio from source.

Let me know if it solves your issue, thanks.

I actually manage to have libtorch built and installed via CMake , our-of-source build under the folder named build.

I wonder while I build Pytorch using python setup.py build -cmake, is there a way to just use the configuration under the folder build already existing there ?

Cheers
Pei