Error building Pytorch 13.1 from Source on OS X 12.5
Labels: module: build, module: protobuf, triaged

### 🐛 Describe the bug

Same error with different versions of protoc:

./src/protoc --version
libprotoc 3.19.4

 ./src/protoc --version
libprotoc 3.21.4

```
 % export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install           
Building wheel torch-1.13.0a0+gitec67c6a
-- Building version 1.13.0a0+gitec67c6a
cmake --build . --target install --config Release
[0/1] Re-running CMake...
-- CLANG_VERSION_STRING:         Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

-- sdk version: 12.3, mps supported: ON
-- MPSGraph framework found
CMake Warning (dev) at /opt/local/share/cmake-3.23/Modules/CMakeDependentOption.cmake:89 (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:259 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/local/share/cmake-3.23/Modules/CMakeDependentOption.cmake:89 (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:290 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could not find ccache. Consider installing ccache to speed up compilation.
-- std::exception_ptr is supported.
-- Turning off deprecation warning due to glog.
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Current compiler supports avx512f extension. Will build fbgemm.
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2 protobuf include directory: /Users/davidlaxer/protobuf/src
-- Trying to find preferred BLAS backend of choice: MKL
-- MKL_THREADING = OMP
-- MKL libraries: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libmkl_intel_lp64.dylib;/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libmkl_intel_thread.dylib;/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libmkl_core.dylib;/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libiomp5.dylib;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libpthread.tbd;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libm.tbd
-- MKL include directory: /Users/davidlaxer/anaconda3/envs/AI-Feynman/include
-- MKL OpenMP type: Intel
-- MKL OpenMP library: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libiomp5.dylib
-- Brace yourself, we are building NNPACK
-- NNPACK backend is x86-64
-- Failed to find LLVM FileCheck
-- git version: v1.6.1 normalized to 1.6.1
-- Version: 1.6.1
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
CMake Warning (dev) at /opt/local/share/cmake-3.23/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: -Xpreprocessor -fopenmp -I/usr/local/include  
CMake Warning (dev) at /opt/local/share/cmake-3.23/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: -Xpreprocessor -fopenmp -I/usr/local/include  
-- Found OpenMP: TRUE   
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):
  ==========


** AsmJit Summary **
   ASMJIT_DIR=/Users/davidlaxer/pytorch/third_party/fbgemm/third_party/asmjit
   ASMJIT_TEST=FALSE
   ASMJIT_TARGET_TYPE=STATIC
   ASMJIT_DEPS=pthread
   ASMJIT_LIBS=asmjit;pthread
   ASMJIT_CFLAGS=-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS=-Wall;-Wextra;-Wconversion;-fno-math-errno;-fno-threadsafe-statics;-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS_DBG=
   ASMJIT_PRIVATE_CFLAGS_REL=-O2;-fmerge-all-constants
-- Using third party subdirectory Eigen.
-- Found PythonInterp: /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/python (found suitable version "3.9.12", minimum required is "3.0") 
-- Found PythonLibs: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libpython3.9.a (found suitable version "3.9.12", minimum required is "3.0") 
-- Using third_party/pybind11.
-- pybind11 include dirs: /Users/davidlaxer/pytorch/cmake/../third_party/pybind11/include
-- Adding OpenMP CXX_FLAGS: -Xpreprocessor -fopenmp -I/usr/local/include
-- No OpenMP library needs to be linked against
-- Found PythonInterp: /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/python (found version "3.9.12") 
-- Found PythonLibs: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libpython3.9.a (found version "3.9.12") 
Generated: /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.proto
Generated: /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.proto
Generated: /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-data_onnx_torch.proto
-- 
-- ******** Summary ********
--   CMake version             : 3.23.3
--   CMake command             : /opt/local/bin/cmake
--   System                    : Darwin
--   C++ compiler              : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
--   C++ compiler version      : 13.1.6.13160021
--   CXX flags                 :  -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/usr/local/include -Wnon-virtual-dtor
--   Build type                : Release
--   Compile definitions       : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;__STDC_FORMAT_MACROS
--   CMAKE_PREFIX_PATH         : /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.9/site-packages;/Users/davidlaxer/anaconda3/envs/AI-Feynman
--   CMAKE_INSTALL_PREFIX      : /Users/davidlaxer/pytorch/torch
--   CMAKE_MODULE_PATH         : /Users/davidlaxer/pytorch/cmake/Modules
-- 
--   ONNX version              : 1.12.0
--   ONNX NAMESPACE            : onnx_torch
--   ONNX_USE_LITE_PROTO       : OFF
--   USE_PROTOBUF_SHARED_LIBS  : OFF
--   Protobuf_USE_STATIC_LIBS  : ON
--   ONNX_DISABLE_EXCEPTIONS   : OFF
--   ONNX_WERROR               : OFF
--   ONNX_BUILD_TESTS          : OFF
--   ONNX_BUILD_BENCHMARKS     : OFF
--   ONNXIFI_DUMMY_BACKEND     : OFF
--   ONNXIFI_ENABLE_EXT        : OFF
-- 
--   Protobuf compiler         : /Users/davidlaxer/protobuf/src/protoc
--   Protobuf includes         : /Users/davidlaxer/protobuf/src
--   Protobuf libraries        : /Users/davidlaxer/protobuf/src/.libs/libprotobuf.dylib
--   BUILD_ONNX_PYTHON         : OFF
-- 
-- ******** Summary ********
--   CMake version         : 3.23.3
--   CMake command         : /opt/local/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
--   C++ compiler version  : 13.1.6.13160021
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/usr/local/include -Wnon-virtual-dtor
--   Build type            : Release
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1
--   CMAKE_PREFIX_PATH     : /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.9/site-packages;/Users/davidlaxer/anaconda3/envs/AI-Feynman
--   CMAKE_INSTALL_PREFIX  : /Users/davidlaxer/pytorch/torch
--   CMAKE_MODULE_PATH     : /Users/davidlaxer/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     : /Users/davidlaxer/protobuf/src/protoc
--   Protobuf includes     : /Users/davidlaxer/protobuf/src
--   Protobuf libraries    : /Users/davidlaxer/protobuf/src/.libs/libprotobuf.dylib
--   BUILD_ONNX_PYTHON     : OFF
-- Could not find CUDA with FP16 support, compiling without torch.CudaHalfTensor
-- Adding -DNDEBUG to 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.
-- Found a library with LAPACK API (mkl).
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
-- MKLDNN_CPU_RUNTIME = OMP
-- DNNL_TARGET_ARCH: X64
-- DNNL_LIBRARY_NAME: dnnl
CMake Warning (dev) at /opt/local/share/cmake-3.23/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/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:69 (find_package)
  third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/local/share/cmake-3.23/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/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:69 (find_package)
  third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find Doxyrest (missing: DOXYREST_EXECUTABLE) 
-- Found PythonInterp: /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/python (found suitable version "3.9.12", minimum required is "2.7") 
-- Could NOT find Sphinx (missing: SPHINX_EXECUTABLE) 
-- Enabled workload: TRAINING
-- Enabled primitives: ALL
-- Enabled primitive CPU ISA: ALL
-- Enabled primitive GPU ISA: ALL
-- Primitive cache is enabled
-- Found MKL-DNN: TRUE
-- Version: 7.0.3
-- Build type: Release
-- CXX_STANDARD: 14
-- Required features: cxx_variadic_templates
-- Using CPU-only version of Kineto
-- Configuring Kineto dependency:
--   KINETO_SOURCE_DIR = /Users/davidlaxer/pytorch/third_party/kineto/libkineto
--   KINETO_BUILD_TESTS = OFF
--   KINETO_LIBRARY_TYPE = static
-- Found PythonInterp: /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/python (found version "3.9.12") 
INFO CUDA_SOURCE_DIR = 
INFO ROCM_SOURCE_DIR = 
INFO CUPTI unavailable or disabled - not building GPU profilers
-- Kineto: FMT_SOURCE_DIR = /Users/davidlaxer/pytorch/third_party/fmt
-- Kineto: FMT_INCLUDE_DIR = /Users/davidlaxer/pytorch/third_party/fmt/include
INFO CUPTI_INCLUDE_DIR = /extras/CUPTI/include
INFO ROCTRACER_INCLUDE_DIR = /include/roctracer
-- Configured Kineto (CPU)
-- don't use NUMA
-- headers outputs: 
-- sources outputs: 
-- declarations_yaml outputs: 
-- Using ATen parallel backend: OMP
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 OpenMP_C: -Xpreprocessor -fopenmp -I/usr/local/include (found version "5.0") 
-- Found OpenMP_CXX: -Xpreprocessor -fopenmp -I/usr/local/include (found version "5.0") 
-- Found OpenMP: TRUE (found version "5.0")  
-- Configuring build for SLEEF-v3.6.0
   Target system: Darwin-21.6.0
   Target processor: x86_64
   Host system: Darwin-21.6.0
   Host processor: x86_64
   Detected C compiler: AppleClang @ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
   CMake: 3.23.3
   Make program: /opt/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 : /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libmpfr.dylib
-- MPFR header file in /Users/davidlaxer/anaconda3/envs/AI-Feynman/include
-- GMP : /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libgmp.dylib
-- RT : 
-- FFTW3 : LIBFFTW3-NOTFOUND
-- OPENSSL : 1.1.1o
-- SDE : SDE_COMMAND-NOTFOUND
-- RUNNING_ON_TRAVIS : 
-- COMPILER_SUPPORTS_OPENMP : 
AT_INSTALL_INCLUDE_DIR include/ATen/core
core header install: /Users/davidlaxer/pytorch/build/aten/src/ATen/core/TensorBody.h
core header install: /Users/davidlaxer/pytorch/build/aten/src/ATen/core/aten_interned_strings.h
core header install: /Users/davidlaxer/pytorch/build/aten/src/ATen/core/enum_tag.h
CMake Warning (dev) at torch/CMakeLists.txt:467:
  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:467:
  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.

CMake Warning (dev) at /opt/local/share/cmake-3.23/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)
  caffe2/CMakeLists.txt:1288 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/local/share/cmake-3.23/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)
  caffe2/CMakeLists.txt:1288 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- pytorch is compiling with OpenMP. 
OpenMP CXX_FLAGS: -Xpreprocessor -fopenmp -I/usr/local/include. 
OpenMP libraries: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libiomp5.dylib.
-- Caffe2 is compiling with OpenMP. 
OpenMP CXX_FLAGS: -Xpreprocessor -fopenmp -I/usr/local/include. 
OpenMP libraries: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libiomp5.dylib.
-- Using lib/python3.9/site-packages as python relative installation path
CMake Warning at CMakeLists.txt:1073 (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.23.3
--   CMake command         : /opt/local/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
--   C++ compiler id       : AppleClang
--   C++ compiler version  : 13.1.6.13160021
--   Using ccache if found : ON
--   Found ccache          : CCACHE_PROGRAM-NOTFOUND
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/usr/local/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-range-loop-analysis -Wno-pass-failed -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wconstant-conversion -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 -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -DUSE_MPS -fno-objc-arc -Wno-unused-private-field -Wno-missing-braces -Wno-c++14-extensions -Wno-constexpr-not-const
--   Build type            : Release
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;ONNX_NAMESPACE=onnx_torch;IDEEP_USE_MKL;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/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.9/site-packages;/Users/davidlaxer/anaconda3/envs/AI-Feynman
--   CMAKE_INSTALL_PREFIX  : /Users/davidlaxer/pytorch/torch
--   USE_GOLD_LINKER       : OFF
-- 
--   TORCH_VERSION         : 1.13.0
--   CAFFE2_VERSION        : 1.13.0
--   BUILD_CAFFE2          : OFF
--   BUILD_CAFFE2_OPS      : OFF
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_TENSOREXPR_BENCHMARK: OFF
--   BUILD_NVFUSER_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : OFF
--     Protobuf compiler   : /Users/davidlaxer/protobuf/src/protoc
--     Protobuf includes   : /Users/davidlaxer/protobuf/src
--     Protobuf libraries  : /Users/davidlaxer/protobuf/src/.libs/libprotobuf.dylib
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : True
--     Python version      : 3.9.12
--     Python executable   : /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/python
--     Pythonlibs version  : 3.9.12
--     Python library      : /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/libpython3.9.a
--     Python includes     : /Users/davidlaxer/anaconda3/envs/AI-Feynman/include/python3.9
--     Python site-packages: lib/python3.9/site-packages
--   BUILD_SHARED_LIBS     : ON
--   CAFFE2_USE_MSVC_STATIC_RUNTIME     : OFF
--   BUILD_TEST            : True
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   BUILD_LITE_INTERPRETER: OFF
--   CROSS_COMPILING_MACOSX : 
--   INTERN_BUILD_MOBILE   : 
--   USE_BLAS              : 1
--     BLAS                : mkl
--     BLAS_HAS_SBGEMM     : 
--   USE_LAPACK            : 1
--     LAPACK              : mkl
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : OFF
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : 
--   USE_FBGEMM            : ON
--     USE_FAKELOWP          : OFF
--   USE_KINETO            : ON
--   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_PYTORCH_METAL_EXPORT     : OFF
--   USE_MPS               : ON
--   USE_FFTW              : OFF
--   USE_MKL               : ON
--   USE_MKLDNN            : ON
--   USE_MKLDNN_ACL        : OFF
--   USE_MKLDNN_CBLAS      : OFF
--   USE_UCC               : OFF
--   USE_ITT               : ON
--   USE_NCCL              : OFF
--   USE_NNPACK            : ON
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : ON
--   USE_TBB               : OFF
--   USE_VULKAN            : OFF
--   USE_PROF              : OFF
--   USE_QNNPACK           : ON
--   USE_PYTORCH_QNNPACK   : ON
--   USE_XNNPACK           : ON
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : OFF
--   USE_DEPLOY           : OFF
--   Public Dependencies  : caffe2::Threads;caffe2::mkl
--   Private Dependencies : pthreadpool;cpuinfo;qnnpack;pytorch_qnnpack;nnpack;XNNPACK;fbgemm;ittnotify;fp16;foxi_loader;fmt::fmt-header-only;kineto
--   USE_COREML_DELEGATE     : OFF
--   BUILD_LAZY_TS_BACKEND   : ON
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/davidlaxer/pytorch/build
[1/2025] Linking CXX static library lib/libfbgemm.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libfbgemm.a(ExecuteKernel.cc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libfbgemm.a(ExecuteKernel.cc.o) has no symbols
[2/2025] Building CXX object third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-operators_onnx_torch-ml.pb.cc.o

FAILED: third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-operators_onnx_torch-ml.pb.cc.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DONNXIFI_ENABLE_EXT=1 -DONNX_API="__attribute__((__visibility__(\"default\")))" -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -D__STDC_FORMAT_MACROS -I/Users/davidlaxer/pytorch/cmake/../third_party/benchmark/include -I/Users/davidlaxer/pytorch/build/third_party/onnx -isystem /Users/davidlaxer/pytorch/cmake/../third_party/googletest/googlemock/include -isystem /Users/davidlaxer/pytorch/cmake/../third_party/googletest/googletest/include -isystem /Users/davidlaxer/protobuf/src -isystem /Users/davidlaxer/anaconda3/envs/AI-Feynman/include -isystem /Users/davidlaxer/pytorch/third_party/gemmlowp -isystem /Users/davidlaxer/pytorch/third_party/neon2sse -isystem /Users/davidlaxer/pytorch/third_party/XNNPACK/include -isystem /Users/davidlaxer/pytorch/third_party/ittapi/include -isystem /Users/davidlaxer/pytorch/cmake/../third_party/eigen -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/usr/local/include -Wnon-virtual-dtor -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.9 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -std=gnu++11 -MD -MT third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-operators_onnx_torch-ml.pb.cc.o -MF third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-operators_onnx_torch-ml.pb.cc.o.d -o third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-operators_onnx_torch-ml.pb.cc.o -c /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.cc
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.cc:4:
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.h:18:2: error: incompatible with your Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers. Please
 ^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.cc:4:
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.h:26:
/usr/local/include/google/protobuf/generated_message_table_driven.h:299:25: error: no template named 'MapEntryHelper'
  bool operator()(const MapEntryHelper<T>& a,
                        ^
/usr/local/include/google/protobuf/generated_message_table_driven.h:300:25: error: no template named 'MapEntryHelper'
                  const MapEntryHelper<T>& b) const {
                        ^
/usr/local/include/google/protobuf/generated_message_table_driven.h:312:11: error: no template named 'MapEntryHelper'
  typedef MapEntryHelper<typename MapFieldType::EntryTypeTrait> Entry;
          ^
/usr/local/include/google/protobuf/generated_message_table_driven.h:325:38: error: member reference base type 'Entry' (aka 'int') is not a structure or union
      output->WriteVarint32(map_entry._cached_size_);
                            ~~~~~~~~~^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/generated_message_table_driven.h:338:33: error: member reference base type 'std::__vector_base<int, std::allocator<int>>::value_type' (aka 'int') is not a structure or union
      output->WriteVarint32(v[i]._cached_size_);
                            ~~~~^~~~~~~~~~~~~~
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.cc:4:
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.h:34:
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:18:2: error: incompatible with your Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers. Please
 ^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5811:63: error: no member named 'EmptyDefault' in 'google::protobuf::internal::ArenaStringPtr'
 name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5824:64: error: no member named 'EmptyDefault' in 'google::protobuf::internal::ArenaStringPtr'
  name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5828:75: error: no member named 'EmptyDefault' in 'google::protobuf::internal::ArenaStringPtr'
  return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5836:19: error: no member named 'ReleaseNonDefault' in 'google::protobuf::internal::ArenaStringPtr'
  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
            ~~~~~ ^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5851:7: error: too many arguments to function call, expected 2, have 3
      GetArenaForAllocation());
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/google/protobuf/arenastring.h:316:8: note: 'SetAllocated' declared here
  void SetAllocated(std::string* value, Arena* arena);
       ^
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.cc:4:
In file included from /Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.pb.h:34:
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5880:72: error: no member named 'EmptyDefault' in 'google::protobuf::internal::ArenaStringPtr'
 ref_attr_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5893:73: error: no member named 'EmptyDefault' in 'google::protobuf::internal::ArenaStringPtr'
  ref_attr_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/davidlaxer/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:5897:84: error: no member named 'EmptyDefault' in 'google::protobuf::internal::ArenaStringPtr'
  return ref_attr_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
```

### Versions

 % python collect_env.py 
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: macOS 12.5 (x86_64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.5)
CMake version: version 3.23.3
Libc version: N/A

Python version: 3.9.12 (main, Jun  1 2022, 06:36:29)  [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.22.3
[pip3] torch==1.13.0a0+gitf4ee374
[pip3] torchvision==0.14.0a0+e75a333
[conda] blas                      1.0                         mkl    anaconda
[conda] mkl                       2021.4.0           hecd8cb5_637    anaconda
[conda] mkl-include               2022.0.0           hecd8cb5_105    anaconda
[conda] mkl-service               2.4.0            py39h9ed2024_0    anaconda
[conda] mkl_fft                   1.3.1            py39h4ab4a9b_0    anaconda
[conda] mkl_random                1.2.2            py39hb2f4e1b_0    anaconda
[conda] numpy                     1.22.3           py39h2e5f0a9_0    anaconda
[conda] numpy-base                1.22.3           py39h3b1a694_0    anaconda
[conda] pytorch                   1.12.0                  py3.9_0    pytorch
[conda] torch                     1.13.0a0+gitf4ee374          pypi_0    pypi
[conda] torchvision               0.14.0a0+e75a333          pypi_0    pypi
(AI-Feynman) davidlaxer@x86_64-apple-darwin13 pytorch % 

Protobuf configuration settings:
<img width="563" alt="Screen Shot 2022-08-04 at 11 05 22 AM" src="https://user-images.githubusercontent.com/3105499/182920511-4d3f9358-88b3-478d-a8a4-4a6b2e289148.png">

<img width="562" alt="Screen Shot 2022-08-04 at 12 04 35 PM" src="https://user-images.githubusercontent.com/3105499/182932957-37901b38-7ef3-43f8-bb33-c0880d6a9b3b.png">


```
% ls -l /Users/davidlaxer/protobuf/src/.libs/libprotobuf.dylib
lrwxr-xr-x  1 davidlaxer  staff  20 Aug  3 20:18 /Users/davidlaxer/protobuf/src/.libs/libprotobuf.dylib -> libprotobuf.30.dylib
```


cc @malfet @seemethere