Pytorch-1.19 issue in building

Hi guys

i cloned pytorch source file from github link : GitHub - pytorch/pytorch at v1.9.0
i am facing issue in building pytorch-1.19, I am getting this log, if anyone having any solution please help me.

WARNING: pytorch-v1.9.0+gitAUTOINC+08ce5eedf5-r0 do_populate_lic: pytorch: No generic license file exists for: Unknown in any provider
WARNING: pytorch-v1.9.0+gitAUTOINC+08ce5eedf5-r0 do_populate_lic: pytorch: No generic license file exists for: BSD-3 in any provider
ERROR: pytorch-v1.9.0+gitAUTOINC+08ce5eedf5-r0 do_configure: Execution of ‘/home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch/v1.9.0+gitAUTOINC+08ce5eedf5-r0/temp/run.do_configure.7816’ failed with exit code 1:
– The CXX compiler identification is GNU 10.2.0
– The C compiler identification is GNU 10.2.0
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch/v1.9.0+gitAUTOINC+08ce5eedf5-r0/recipe-sysroot-native/usr/bin/riscv64-oe-linux/riscv64-oe-linux-g++ - 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: /home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch/v1.9.0+gitAUTOINC+08ce5eedf5-r0/recipe-sysroot-native/usr/bin/riscv64-oe-linux/riscv64-oe-linux-gcc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Not forcing any particular BLAS to be found
– Could not find ccache. Consider installing ccache to speed up compilation.
– Build type not set - defaulting to Release
– Performing Test COMPILER_WORKS
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
COMPILER_WORKS_EXITCODE (advanced)
COMPILER_WORKS_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see /home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch/v1.9.0+gitAUTOINC+08ce5eedf5-r0/build/TryRunResults.cmake
– Performing Test COMPILER_WORKS - Failed
– 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 - Failed
– Turning off deprecation warning due to glog.
– Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS
– Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS - Failed
– 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
– Building using own protobuf under third_party per request.
– Use custom protobuf build.

– 3.11.4.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:/home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch/v1.9.0+gitAUTOINC+08ce5eedf5-r0/git/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:156 (message):
MKL could not be found. Defaulting to Eigen
Call Stack (most recent call first):
CMakeLists.txt:632 (include)

CMake Warning at cmake/Dependencies.cmake:179 (message):
Preferred BLAS (MKL) cannot be found, now searching for a general BLAS
library
Call Stack (most recent call first):
CMakeLists.txt:632 (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 [openblas]
– Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
– Checking for [openblas - pthread - m]
– Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
– Checking for [openblas - pthread - m - gomp]
– Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
– Checking for [goto2 - gfortran]
– Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
– Checking for [goto2 - gfortran - pthread]
– Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
– Checking for [acml - gfortran]
– Library acml: BLAS_acml_LIBRARY-NOTFOUND
– Checking for [blis]
– Library blis: BLAS_blis_LIBRARY-NOTFOUND
– Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
– Checking for [ptf77blas - atlas - gfortran]
– Library ptf77blas: BLAS_ptf77blas_LIBRARY-NOTFOUND
– Checking for [blas]
– Library blas: BLAS_blas_LIBRARY-NOTFOUND
– Cannot find a library with BLAS API. Not using BLAS.
CMake Warning at cmake/Dependencies.cmake:257 (message):
Target architecture “riscv64” is not supported in {Q/X}NNPACK. Supported
architectures are x86, x86-64, ARM, and ARM64. Turn this warning off by
USE_{Q/X}NNPACK=OFF.
Call Stack (most recent call first):
CMakeLists.txt:632 (include)

CMake Warning at third_party/cpuinfo/CMakeLists.txt:65 (MESSAGE):
Target processor architecture “riscv64” is not supported in cpuinfo.
cpuinfo will compile, but cpuinfo_initialize() will always fail.

CMake Warning at cmake/Dependencies.cmake:705 (message):
A compiler with AVX512 support is required for FBGEMM. Not compiling with
FBGEMM. Turn this warning off by USE_FBGEMM=OFF.
Call Stack (most recent call first):
CMakeLists.txt:632 (include)

CMake Warning at cmake/Dependencies.cmake:744 (message):
Turning USE_FAKELOWP off as it depends on USE_FBGEMM.
Call Stack (most recent call first):
CMakeLists.txt:632 (include)

– Could NOT find Numa (missing: Numa_INCLUDE_DIR Numa_LIBRARIES)
CMake Warning at cmake/Dependencies.cmake:793 (message):
Not compiling with NUMA. Suppress this warning with -DUSE_NUMA=OFF
Call Stack (most recent call first):
CMakeLists.txt:632 (include)

After getting this issue, i build successfully numpy and typing-extensions and adding in recipes of pytorch, again I am facing this, please help me.

T&R
Kush Kumar

Based on the log it seems the build is failing in:

CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
COMPILER_WORKS_EXITCODE (advanced)
COMPILER_WORKS_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see /home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch

which points towards cross-compiling for a RISCV platform so you might need to set these cmake variables.

PS: you can post code snippets and logs by wrapping them into three backticks ```, which would make debugging easier. :wink: