I also had this problem for a long time while installing on linux and have no idea how to deal with it. Any help will be appreciated!
Here is my console output:
Building wheel torch-1.9.0a0+git55dfb4a

-- Building version 1.9.0a0+git55dfb4a

cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/caowanlu/fnet/pytorch/torch -DCMAKE_PREFIX_PATH=/usr/lib/python3/dist-packages -DNUMPY_INCLUDE_DIR=/home/caowanlu/.local/lib/python3.6/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/libpython3.6m.so.1.0 -DTORCH_BUILD_VERSION=1.9.0a0+git55dfb4a -DUSE_NUMPY=True /home/caowanlu/fnet/pytorch

-- The CXX compiler identification is GNU 7.5.0

-- The C compiler identification is GNU 7.5.0

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Check for working CXX compiler: /usr/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/bin/cc - skipped

-- Detecting C compile features

-- Detecting C compile features - done

-- Not forcing any particular BLAS to be found

-- 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 - Failed

-- Turning off deprecation warning due to glog.

-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS

-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS - 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

-- 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/caowanlu/fnet/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

CMake Warning (dev) at /home/caowanlu/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (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)

cmake/Modules/FindMKL.cmake:213 (FIND_PACKAGE)

cmake/Modules/FindMKL.cmake:307 (CHECK_ALL_LIBRARIES)

cmake/Dependencies.cmake:140 (find_package)

CMakeLists.txt:615 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /home/caowanlu/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (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)

cmake/Modules/FindMKL.cmake:213 (FIND_PACKAGE)

cmake/Modules/FindMKL.cmake:307 (CHECK_ALL_LIBRARIES)

cmake/Dependencies.cmake:140 (find_package)

CMakeLists.txt:615 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for cblas_sgemm

-- Looking for cblas_sgemm - found

-- MKL libraries: /home/caowanlu/anaconda3/lib/libmkl_intel_lp64.so;/home/caowanlu/anaconda3/lib/libmkl_gnu_thread.so;/home/caowanlu/anaconda3/lib/libmkl_core.so;-fopenmp;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libm.so;/usr/lib/x86_64-linux-gnu/libdl.so

-- MKL include directory: /home/caowanlu/anaconda3/include

-- MKL OpenMP type: GNU

-- MKL OpenMP library: -fopenmp

-- The ASM compiler identification is GNU

-- Found assembler: /usr/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/python3 (found version "3.6.9")

-- NNPACK backend is x86-64

CMake Deprecation Warning at third_party/googletest/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell

CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at third_party/googletest/googlemock/CMakeLists.txt:42 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell

CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at third_party/googletest/googletest/CMakeLists.txt:49 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell

CMake that the project does not need compatibility with older versions.

-- Failed to find LLVM FileCheck

-- Found Git: /usr/bin/git (found version "2.17.1")

-- git Version: v1.4.0-505be96a-dirty

-- Version: 1.4.0

-- 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_LPTHREAD

-- Performing Test HAVE_CXX_FLAG_LPTHREAD - 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_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_WFLOAT_EQUAL

-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success

-- 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_WSTRICT_ALIASING

-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success

-- 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 /home/caowanlu/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (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:60 (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 /home/caowanlu/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (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:60 (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:62 (message):

OpenMP found! OpenMP_C_INCLUDE_DIRS =

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

==========

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

CMAKE_BUILD_TYPE = Release

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

CMAKE_CXX_FLAGS_DEBUG is -g

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

CMAKE_CXX_FLAGS_RELEASE is -O3 -DNDEBUG

CMake Warning at third_party/fbgemm/CMakeLists.txt:146 (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=/home/caowanlu/fnet/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/python3 (found suitable version "3.6.9", minimum required is "3.0")

-- Found PythonLibs: /usr/lib/libpython3.6m.so.1.0 (found suitable version "3.6.9", minimum required is "3.0")

-- Could NOT find pybind11 (missing: pybind11_DIR)

-- Could NOT find pybind11 (missing: pybind11_INCLUDE_DIR)

-- Using third_party/pybind11.

-- pybind11 include dirs: /home/caowanlu/fnet/pytorch/cmake/../third_party/pybind11/include

-- Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so (found version "3.1")

-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1")

-- Found MPI: TRUE (found version "3.1")

-- MPI support found

-- MPI compile flags: -pthread

-- MPI include path: /usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include/usr/lib/x86_64-linux-gnu/openmpi/include

-- MPI LINK flags path: -L/usr/lib -pthread

-- MPI libraries: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so

CMake Warning at cmake/Dependencies.cmake:1040 (message):

OpenMPI found, but it is not built with CUDA support.

Call Stack (most recent call first):

CMakeLists.txt:615 (include)

CMake Warning (dev) at /home/caowanlu/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (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)

cmake/Dependencies.cmake:1100 (find_package)

CMakeLists.txt:615 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /home/caowanlu/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (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)

cmake/Dependencies.cmake:1100 (find_package)

CMakeLists.txt:615 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

-- Adding OpenMP CXX_FLAGS: -fopenmp

-- Will link against OpenMP libraries: /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.so

-- Found CUDA: /usr/local/cuda (found version "11.0")

-- Caffe2: CUDA detected: 11.0

-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc

-- Caffe2: CUDA toolkit directory: /usr/local/cuda

-- Caffe2: Header version is: 11.0

-- Found CUDNN: /usr/local/cuda/lib64/libcudnn.so

-- Found cuDNN: v8.1.0 (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so)

-- /usr/local/cuda/lib64/libnvrtc.so shorthash is f4909b87

-- Autodetected CUDA architecture(s): 7.5

-- Added CUDA NVCC flags for: -gencode;arch=compute_75,code=sm_75

-- Found HIP: /opt/rocm-4.0.0/hip (found suitable version "4.0.20496-4f163c68", minimum required is "1.0")

HIP VERSION: 4.0.20496-4f163c68

***** ROCm version from /opt/rocm/.info/version-dev ****

ROCM_VERSION_DEV: 4.0.0

ROCM_VERSION_DEV_MAJOR: 4

ROCM_VERSION_DEV_MINOR: 0

ROCM_VERSION_DEV_PATCH: 0

***** Library versions from dpkg *****

rocm-dev VERSION: 4.0.0.40000-23

rocm-device-libs VERSION: 1.0.0.637-rocm-rel-4.0-23-db8c0c3

hsakmt-roct VERSION: 20201016.1.0269-mainline-20201016-1-g0269ce3

hsakmt-roct-dev VERSION: 20201016.1.0269-mainline-20201016-1-g0269ce3

hsa-rocr-dev VERSION: 1.2.40000.0-rocm-rel-4.0-23-a5173c90

***** Library versions from cmake find_package *****

hip VERSION: 4.0.20496

hsa-runtime64 VERSION: 1.2.40000

amd_comgr VERSION: 1.9.0.194-rocm-rel-4.0-23-0fa438b

CMake Error at cmake/public/LoadHIP.cmake:138 (find_package):

By not providing "Findrocrand.cmake" in CMAKE_MODULE_PATH this project has

asked CMake to find a package configuration file provided by "rocrand", but

CMake did not find one.

Could not find a package configuration file provided by "rocrand" with any

of the following names:

rocrandConfig.cmake

rocrand-config.cmake

Add the installation prefix of "rocrand" to CMAKE_PREFIX_PATH or set

"rocrand_DIR" to a directory containing one of the above files. If

"rocrand" provides a separate development package or SDK, be sure it has

been installed.

Call Stack (most recent call first):

cmake/public/LoadHIP.cmake:197 (find_package_and_print_version)

cmake/Dependencies.cmake:1189 (include)

CMakeLists.txt:615 (include)

-- Configuring incomplete, errors occurred!

See also "/home/caowanlu/fnet/pytorch/build/CMakeFiles/CMakeOutput.log".

See also "/home/caowanlu/fnet/pytorch/build/CMakeFiles/CMakeError.log".

Traceback (most recent call last):

File "setup.py", line 876, in <module>

build_deps()

File "setup.py", line 359, in build_deps

cmake=cmake)

File "/home/caowanlu/fnet/pytorch/tools/build_pytorch_libs.py", line 55, in build_caffe2

rerun_cmake)

File "/home/caowanlu/fnet/pytorch/tools/setup_helpers/cmake.py", line 329, in generate

self.run(args, env=my_env)

File "/home/caowanlu/fnet/pytorch/tools/setup_helpers/cmake.py", line 140, in run

check_call(command, cwd=self.build_dir, env=env)

File "/usr/lib/python3.6/subprocess.py", line 311, in check_call

raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['cmake', '-GNinja', '-DBUILD_PYTHON=True', '-DBUILD_TEST=True', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_INSTALL_PREFIX=/home/caowanlu/fnet/pytorch/torch', '-DCMAKE_PREFIX_PATH=/usr/lib/python3/dist-packages', '-DNUMPY_INCLUDE_DIR=/home/caowanlu/.local/lib/python3.6/site-packages/numpy/core/include', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DPYTHON_INCLUDE_DIR=/usr/include/python3.6m', '-DPYTHON_LIBRARY=/usr/lib/libpython3.6m.so.1.0', '-DTORCH_BUILD_VERSION=1.9.0a0+git55dfb4a', '-DUSE_NUMPY=True', '/home/caowanlu/fnet/pytorch']' returned non-zero exit status 1.