Unable to disable caffe2 build on Mac Os

discort: <p>When I try to build from source on Mac OS:</p>
<pre><code class="lang-auto">DEBUG=1 USE_PTHREADPOOL=0 BUILD_CAFFE2=0 BUILD_CAFFE2_OPS=0 USE_DISTRIBUTED=0 USE_MKLDNN=0 USE_CUDA=0 USE_CUDNN=0 BUILD_TEST=0 USE_FBGEMM=0 USE_NNPACK=0 USE_QNNPACK=0 USE_XNNPACK=0 python setup.py develop
</code></pre>
<p>I’m getting:</p>
<pre><code class="lang-auto">[167/1338] Building C object confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o
FAILED: confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -DFXDIV_USE_INLINE_ASSEMBLY=0 -DPTHREADPOOL_ENABLE_FASTPATH=1 -I/opt/local/include -I../third_party/pthreadpool/src -I../third_party/pthreadpool/include -I../third_party/FXdiv/include -isystem ../third_party/protobuf/src -g -fPIC -std=c11 -MD -MT confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o -MF confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o.d -o confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o -c ../third_party/pthreadpool/src/gcd.c
../third_party/pthreadpool/src/gcd.c:122:40: error: use of undeclared identifier 'DISPATCH_APPLY_AUTO'
        dispatch_apply_f(threads_count.value, DISPATCH_APPLY_AUTO, threadpool, thread_main);
                                              ^
1 error generated.
[170/1338] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotobuf-lite.dir/__/src/google/protobuf/repeated_field.cc.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 876, in &lt;module&gt;
    build_deps()
  File "setup.py", line 354, in build_deps
    build_caffe2(version=version,
  File "/Users/discort/python/projects/pytorch/tools/build_pytorch_libs.py", line 58, in build_caffe2
    cmake.build(my_env)
  File "/Users/discort/python/projects/pytorch/tools/setup_helpers/cmake.py", line 345, in build
    self.run(build_args, my_env)
  File "/Users/discort/python/projects/pytorch/tools/setup_helpers/cmake.py", line 140, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Debug', '--', '-j', '4']' returned non-zero exit status 1.
</code></pre>
<p>Questions:</p>
<ol>
<li>Why <code>caffe2</code> is building when I explicitly specify <code>BUILD_CAFFE2=0</code>?</li>
<li>How to exclude a building of <code>PTHREADPOOL</code> ?</li>
</ol>
<details><summary>Full logs:</summary>
<p>
</p>
<pre><code class="lang-auto">Building wheel torch-1.9.0a0+git7985753
-- Building version 1.9.0a0+git7985753
cmake -GNinja -DBUILD_CAFFE2=0 -DBUILD_CAFFE2_OPS=0 -DBUILD_PYTHON=True -DBUILD_TEST=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/Users/discort/python/projects/pytorch/torch -DCMAKE_PREFIX_PATH=/Users/discort/python/projects/pytorch/.env/lib/python3.8/site-packages -DNUMPY_INCLUDE_DIR=/Users/discort/python/projects/pytorch/.env/lib/python3.8/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/Users/discort/python/projects/pytorch/.env/bin/python -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/include/python3.8 -DPYTHON_LIBRARY=/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/Python.framework/Versions/3.8/Python -DTORCH_BUILD_VERSION=1.9.0a0+git7985753 -DUSE_CUDA=0 -DUSE_CUDNN=0 -DUSE_DISTRIBUTED=0 -DUSE_FBGEMM=0 -DUSE_MKLDNN=0 -DUSE_NNPACK=0 -DUSE_NUMPY=True -DUSE_PTHREADPOOL=0 -DUSE_QNNPACK=0 -DUSE_XNNPACK=0 /Users/discort/python/projects/pytorch
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- The C compiler identification is AppleClang 9.0.0.9000039
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Not forcing any particular BLAS to be found
-- CLANG_VERSION_STRING:         9.0
-- ML Compute framework not found
-- Could not find ccache. Consider installing ccache to speed up compilation.
-- 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 - Success
-- Found Threads: TRUE
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Caffe2 protobuf include directory: $&lt;BUILD_INTERFACE:/Users/discort/python/projects/pytorch/third_party/protobuf/src&gt;$&lt;INSTALL_INTERFACE:include&gt;
-- 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:604 (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:604 (include)


-- MKL_THREADING = OMP
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - iomp5 - pthread - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - iomp5 - pthread - m]
--   Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - guide - pthread - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - guide - pthread - m]
--   Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread - m]
--   Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core - m]
--   Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_core - iomp5 - pthread - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_core - iomp5 - pthread - m]
--   Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_core - guide - pthread - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_core - guide - pthread - m]
--   Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_core - pthread - m]
--   Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_core - pthread - m]
--   Library mkl_intel: 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: /System/Library/Frameworks/Accelerate.framework
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Performing Test BLAS_F2C_DOUBLE_WORKS
-- Performing Test BLAS_F2C_DOUBLE_WORKS - Success
-- Performing Test BLAS_F2C_FLOAT_WORKS
-- Performing Test BLAS_F2C_FLOAT_WORKS - Failed
-- This BLAS uses the F2C return conventions
-- Performing Test BLAS_USE_CBLAS_DOT
-- Performing Test BLAS_USE_CBLAS_DOT - Success
-- Found a library with BLAS API (accelerate). Full path: (/System/Library/Frameworks/Accelerate.framework)
-- The ASM compiler identification is AppleClang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
CMake Warning at cmake/Dependencies.cmake:738 (message):
  Turning USE_FAKELOWP off as it depends on USE_FBGEMM.
Call Stack (most recent call first):
  CMakeLists.txt:604 (include)


-- Using third party subdirectory Eigen.
-- Found PythonInterp: /Users/discort/python/projects/pytorch/.env/bin/python (found suitable version "3.8.6", minimum required is "3.0")
-- Found PythonLibs: /usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/Python.framework/Versions/3.8/Python (found suitable version "3.8.6", 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: /Users/discort/python/projects/pytorch/cmake/../third_party/pybind11/include
-- MKL_THREADING = OMP
-- MKL_THREADING = OMP
-- MKL_THREADING = OMP
-- MKL_THREADING = OMP
CMake Warning (dev) at /usr/local/Cellar/cmake/3.18.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:273 (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:1104 (find_package)
  CMakeLists.txt:604 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/Cellar/cmake/3.18.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:273 (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:1104 (find_package)
  CMakeLists.txt:604 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning at cmake/Dependencies.cmake:1122 (message):
  Not compiling with OpenMP.  Suppress this warning with -DUSE_OPENMP=OFF
Call Stack (most recent call first):
  CMakeLists.txt:604 (include)


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


Generated: /Users/discort/python/projects/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.proto
Generated: /Users/discort/python/projects/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.proto
Generated: /Users/discort/python/projects/pytorch/build/third_party/onnx/onnx/onnx-data_onnx_torch.proto
--
-- ******** Summary ********
--   CMake version         : 3.18.4
--   CMake command         : /usr/local/Cellar/cmake/3.18.4/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Library/Developer/CommandLineTools/usr/bin/c++
--   C++ compiler version  : 9.0.0.9000039
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -Wnon-virtual-dtor
--   Build type            : Debug
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1
--   CMAKE_PREFIX_PATH     : /Users/discort/python/projects/pytorch/.env/lib/python3.8/site-packages
--   CMAKE_INSTALL_PREFIX  : /Users/discort/python/projects/pytorch/torch
--   CMAKE_MODULE_PATH     : /Users/discort/python/projects/pytorch/cmake/Modules
--
--   ONNX version          : 1.8.0
--   ONNX NAMESPACE        : onnx_torch
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
--   ONNXIFI_ENABLE_EXT    : OFF
--
--   Protobuf compiler     :
--   Protobuf includes     :
--   Protobuf libraries    :
--   BUILD_ONNX_PYTHON     : OFF
--
-- ******** Summary ********
--   CMake version         : 3.18.4
--   CMake command         : /usr/local/Cellar/cmake/3.18.4/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Library/Developer/CommandLineTools/usr/bin/c++
--   C++ compiler version  : 9.0.0.9000039
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -Wnon-virtual-dtor
--   Build type            : Debug
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1
--   CMAKE_PREFIX_PATH     : /Users/discort/python/projects/pytorch/.env/lib/python3.8/site-packages
--   CMAKE_INSTALL_PREFIX  : /Users/discort/python/projects/pytorch/torch
--   CMAKE_MODULE_PATH     : /Users/discort/python/projects/pytorch/cmake/Modules
--
--   ONNX version          : 1.4.1
--   ONNX NAMESPACE        : onnx_torch
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
--
--   Protobuf compiler     :
--   Protobuf includes     :
--   Protobuf libraries    :
--   BUILD_ONNX_PYTHON     : OFF
-- Could not find CUDA with FP16 support, compiling without torch.CudaHalfTensor
-- Removing -DNDEBUG from compile flags
-- MAGMA not found. Compiling without MAGMA support
-- Could not find hardware support for NEON on this machine.
-- No OMAP3 processor on this machine.
-- No OMAP4 processor on this machine.
-- Looking for cpuid.h
-- Looking for cpuid.h - found
-- Performing Test HAVE_GCC_GET_CPUID
-- Performing Test HAVE_GCC_GET_CPUID - Success
-- Performing Test NO_GCC_EBX_FPIC_BUG
-- Performing Test NO_GCC_EBX_FPIC_BUG - 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 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
-- AVX compiler support found
-- AVX2 compiler support found
-- Looking for cheev_
-- Looking for cheev_ - found
-- Found a library with LAPACK API (accelerate).
disabling CUDA because NOT USE_CUDA is set
-- USE_CUDNN is set to 0. Compiling without cuDNN support
disabling ROCM because NOT USE_ROCM is set
-- MIOpen not found. Compiling without MIOpen support
disabling MKLDNN because USE_MKLDNN is not set
-- Looking for mmap
-- Looking for mmap - found
-- Looking for shm_open
-- Looking for shm_open - found
-- Looking for shm_unlink
-- Looking for shm_unlink - found
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - not found
-- Performing Test C_HAS_THREAD
-- Performing Test C_HAS_THREAD - Success
-- Version: 7.0.3
-- Build type: Debug
-- CXX_STANDARD: 14
-- Performing Test has_std_14_flag
-- Performing Test has_std_14_flag - Success
-- Performing Test has_std_1y_flag
-- Performing Test has_std_1y_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Failed
-- Required features: cxx_variadic_templates
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Failed
-- Looking for strtod_l
-- Looking for strtod_l - found
-- Not using libkineto in a Mac build.
-- CUDA build detected, configuring Kineto with CUPTI support.
-- 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
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include
-- don't use NUMA
-- Performing Test COMPILER_SUPPORTS_NO_AVX256_SPLIT
-- Performing Test COMPILER_SUPPORTS_NO_AVX256_SPLIT - Failed
-- Using ATen parallel backend: NATIVE
disabling CUDA because USE_CUDA is set false
CMake Deprecation Warning at third_party/sleef/CMakeLists.txt:91 (cmake_policy):
  The OLD behavior for policy CMP0066 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Found OpenSSL: /usr/lib/libcrypto.dylib (found version "1.0.2r")
-- Check size of long double
-- Check size of long double - done
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE - Success
-- Performing Test COMPILER_SUPPORTS_FLOAT128
-- Performing Test COMPILER_SUPPORTS_FLOAT128 - Failed
-- Performing Test COMPILER_SUPPORTS_SSE2
-- Performing Test COMPILER_SUPPORTS_SSE2 - Success
-- Performing Test COMPILER_SUPPORTS_SSE4
-- Performing Test COMPILER_SUPPORTS_SSE4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX
-- Performing Test COMPILER_SUPPORTS_AVX - Success
-- Performing Test COMPILER_SUPPORTS_FMA4
-- Performing Test COMPILER_SUPPORTS_FMA4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- Performing Test COMPILER_SUPPORTS_AVX512F
-- Performing Test COMPILER_SUPPORTS_AVX512F - Success
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES - Failed
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH - Success
-- Performing Test COMPILER_SUPPORTS_SYS_GETRANDOM
-- Performing Test COMPILER_SUPPORTS_SYS_GETRANDOM - Failed
-- Configuring build for SLEEF-v3.6.0
   Target system: Darwin-16.7.0
   Target processor: x86_64
   Host system: Darwin-16.7.0
   Host processor: x86_64
   Detected C compiler: AppleClang @ /Library/Developer/CommandLineTools/usr/bin/cc
   CMake: 3.18.4
   Make program: /usr/local/bin/ninja
-- Using option `-Wall -Wno-unused -Wno-attributes -Wno-unused-result -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
-- Building shared libs : OFF
-- Building static test bins: OFF
-- MPFR : /usr/local/lib/libmpfr.dylib
-- MPFR header file in /usr/local/include
-- GMP : /usr/local/lib/libgmp.dylib
-- RT :
-- FFTW3 : /opt/local/lib/libfftw3.dylib
-- OPENSSL : 1.0.2r
-- SDE : SDE_COMMAND-NOTFOUND
-- RUNNING_ON_TRAVIS :
-- COMPILER_SUPPORTS_OPENMP :
AT_INSTALL_INCLUDE_DIR include/ATen/core
core header install: /Users/discort/python/projects/pytorch/build/aten/src/ATen/core/TensorBody.h
CMake Warning (dev) at torch/CMakeLists.txt:345:
  Syntax Warning in cmake code at column 107

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at torch/CMakeLists.txt:345:
  Syntax Warning in cmake code at column 115

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Using lib/python3.8/site-packages as python relative installation path
CMake Warning at CMakeLists.txt:895 (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.


--
-- ******** Summary ********
-- General:
--   CMake version         : 3.18.4
--   CMake command         : /usr/local/Cellar/cmake/3.18.4/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Library/Developer/CommandLineTools/usr/bin/c++
--   C++ compiler id       : AppleClang
--   C++ compiler version  : 9.0.0.9000039
--   Using ccache if found : ON
--   Found ccache          : CCACHE_PROGRAM-NOTFOUND
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -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 -faligned-new -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-unused-private-field -Wno-missing-braces -Wno-c++14-extensions -Wno-constexpr-not-const
--   Build type            : Debug
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;ONNX_NAMESPACE=onnx_torch;HAVE_MMAP=1;_FILE_OFFSET_BITS=64;HAVE_SHM_OPEN=1;HAVE_SHM_UNLINK=1;USE_EXTERNAL_MZCRC;MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
--   CMAKE_PREFIX_PATH     : /Users/discort/python/projects/pytorch/.env/lib/python3.8/site-packages
--   CMAKE_INSTALL_PREFIX  : /Users/discort/python/projects/pytorch/torch
--
--   TORCH_VERSION         : 1.9.0
--   CAFFE2_VERSION        : 1.9.0
--   BUILD_CAFFE2          : 0
--   BUILD_CAFFE2_OPS      : OFF
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_TENSOREXPR_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : ON
--     Link local protobuf : ON
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : True
--     Python version      : 3.8.6
--     Python executable   : /Users/discort/python/projects/pytorch/.env/bin/python
--     Pythonlibs version  : 3.8.6
--     Python library      : /usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/Python.framework/Versions/3.8/Python
--     Python includes     : /usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/include/python3.8
--     Python site-packages: lib/python3.8/site-packages
--   BUILD_SHARED_LIBS     : ON
--   CAFFE2_USE_MSVC_STATIC_RUNTIME     : OFF
--   BUILD_TEST            : False
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   BUILD_LITE_INTERPRETER: OFF
--   CROSS_COMPILING_MACOSX :
--   INTERN_BUILD_MOBILE   :
--   USE_BLAS              : 1
--     BLAS                : accelerate
--   USE_LAPACK            : 1
--     LAPACK              : accelerate
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : 0
--   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              : ON
--   USE_MKL               : OFF
--   USE_MKLDNN            : 0
--   USE_NCCL              : OFF
--   USE_NNPACK            : 0
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : OFF
--   USE_TBB               : OFF
--   USE_VULKAN            : OFF
--   USE_PROF              : OFF
--   USE_QNNPACK           : 0
--   USE_PYTORCH_QNNPACK   : ON
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : 0
--   USE_DEPLOY           : OFF
--   Public Dependencies  : Threads::Threads
--   Private Dependencies : pthreadpool;cpuinfo;pytorch_qnnpack;fp16;foxi_loader;fmt::fmt-header-only
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/discort/python/projects/pytorch/build
cmake --build . --target install --config Debug -- -j 4
[164/1338] Building C object confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/legacy-api.c.o
../third_party/pthreadpool/src/legacy-api.c:64:2: warning: 'pthreadpool_function_3d_tiled_t' is deprecated [-Wdeprecated-declarations]
        pthreadpool_function_3d_tiled_t function;
        ^
../third_party/pthreadpool/include/pthreadpool.h:992:104: note: 'pthreadpool_function_3d_tiled_t' has been explicitly marked deprecated here
typedef void (*pthreadpool_function_3d_tiled_t)(void*, size_t, size_t, size_t, size_t, size_t, size_t) PTHREADPOOL_DEPRECATED;
                                                                                                       ^
../third_party/pthreadpool/include/pthreadpool.h:983:48: note: expanded from macro 'PTHREADPOOL_DEPRECATED'
        #define PTHREADPOOL_DEPRECATED __attribute__((__deprecated__))
                                                      ^
../third_party/pthreadpool/src/legacy-api.c:138:2: warning: 'pthreadpool_function_4d_tiled_t' is deprecated [-Wdeprecated-declarations]
        pthreadpool_function_4d_tiled_t function;
        ^
../third_party/pthreadpool/include/pthreadpool.h:993:120: note: 'pthreadpool_function_4d_tiled_t' has been explicitly marked deprecated here
typedef void (*pthreadpool_function_4d_tiled_t)(void*, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t) PTHREADPOOL_DEPRECATED;
                                                                                                                       ^
../third_party/pthreadpool/include/pthreadpool.h:983:48: note: expanded from macro 'PTHREADPOOL_DEPRECATED'
        #define PTHREADPOOL_DEPRECATED __attribute__((__deprecated__))
                                                      ^
2 warnings generated.
[167/1338] Building C object confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o
FAILED: confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -DFXDIV_USE_INLINE_ASSEMBLY=0 -DPTHREADPOOL_ENABLE_FASTPATH=1 -I/opt/local/include -I../third_party/pthreadpool/src -I../third_party/pthreadpool/include -I../third_party/FXdiv/include -isystem ../third_party/protobuf/src -g -fPIC -std=c11 -MD -MT confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o -MF confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o.d -o confu-deps/pthreadpool/CMakeFiles/pthreadpool.dir/src/gcd.c.o -c ../third_party/pthreadpool/src/gcd.c
../third_party/pthreadpool/src/gcd.c:122:40: error: use of undeclared identifier 'DISPATCH_APPLY_AUTO'
        dispatch_apply_f(threads_count.value, DISPATCH_APPLY_AUTO, threadpool, thread_main);
                                              ^
1 error generated.
[170/1338] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotobuf-lite.dir/__/src/google/protobuf/repeated_field.cc.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 876, in &lt;module&gt;
    build_deps()
  File "setup.py", line 354, in build_deps
    build_caffe2(version=version,
  File "/Users/discort/python/projects/pytorch/tools/build_pytorch_libs.py", line 58, in build_caffe2
    cmake.build(my_env)
  File "/Users/discort/python/projects/pytorch/tools/setup_helpers/cmake.py", line 345, in build
    self.run(build_args, my_env)
  File "/Users/discort/python/projects/pytorch/tools/setup_helpers/cmake.py", line 140, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Debug', '--', '-j', '4']' returned non-zero exit status 1.
</code></pre>
<p></p>
</details>

fxmarty: <p><a class="mention" href="/u/discort">@discort</a> Did you manage to solve the issue?</p>
<p>Building with <code>CMAKE_BUILD_TYPE=RelWithDebInfo BUILD_TEST=0 BUILD_CAFFE2=0 BUILD_CAFFE2_OPS=0 USE_DISTRIBUTED=0 USE_ROCM=0 USE_FBGEMM=0 USE_QNNPACK=0 python setup.py install</code> still prints build of caffe2, e.g.:</p>
<pre><code class="lang-auto">[5453/6073] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/api/src/optim/serialize.cpp.o
[5454/6073] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/api/src/optim/adagrad.cpp.o
[5455/6073] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/api/src/optim/adamw.cpp.o
[5456/6073] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/api/src/nn/modules/rnn.cpp.o
</code></pre>