pybind/python_example

Compilation issue on macOS 12.3

mustafaquraish opened this issue · 0 comments

This likely seems to be an issue on my end, but I haven't been able to figure this out, so hopefully someone on here has an idea. Here's the error I get when I clone the repo and run pip install --verbose ..

For context, I'm in a 2019 16" macbook pro (Intel i7, so shouldn't be any ARM weirdness with m1 chips).

$ pip install --verbose . 
Using pip 22.0.4 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)
Processing /Users/mustafa/scratch/python_example
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=42
    Using cached setuptools-62.1.0-py3-none-any.whl (1.1 MB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Collecting pybind11>=2.8.0
    Using cached pybind11-2.9.2-py2.py3-none-any.whl (213 kB)
  Installing collected packages: wheel, setuptools, pybind11
  Successfully installed pybind11-2.9.2 setuptools-62.1.0 wheel-0.37.1
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  running egg_info
  writing python_example.egg-info/PKG-INFO
  writing dependency_links to python_example.egg-info/dependency_links.txt
  writing requirements to python_example.egg-info/requires.txt
  writing top-level names to python_example.egg-info/top_level.txt
  reading manifest file 'python_example.egg-info/SOURCES.txt'
  adding license file 'LICENSE'
  writing manifest file 'python_example.egg-info/SOURCES.txt'
  Getting requirements to build wheel ... done
  Running command Preparing metadata (pyproject.toml)
  running dist_info
  creating /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info
  writing /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/PKG-INFO
  writing dependency_links to /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/dependency_links.txt
  writing requirements to /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/requires.txt
  writing top-level names to /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/top_level.txt
  writing manifest file '/private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/SOURCES.txt'
  reading manifest file '/private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/SOURCES.txt'
  adding license file 'LICENSE'
  writing manifest file '/private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example.egg-info/SOURCES.txt'
  creating '/private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-modern-metadata-u0parlky/python_example-0.0.1.dist-info'
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: python-example
  Running command Building wheel for python-example (pyproject.toml)
  running bdist_wheel
  running build
  running build_ext
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c flagcheck.cpp -o flagcheck.o -std=c++17
  building 'python_example' extension
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DVERSION_INFO=0.0.1 -I/private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/main.cpp -o build/temp.macosx-10.9-universal2-cpython-310/src/main.o -std=c++17 -mmacosx-version-min=10.14 -fvisibility=hidden -g0 -stdlib=libc++
  In file included from src/main.cpp:1:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h:213:
  In file included from /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:11:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/limits.h:58:
  In file included from /Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include/limits.h:37:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/limits.h:63:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
  #error Unsupported architecture
   ^
  In file included from src/main.cpp:1:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h:213:
  In file included from /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:11:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/limits.h:58:
  In file included from /Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include/limits.h:37:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/limits.h:64:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/limits.h:8:2: error: architecture not supported
  #error architecture not supported
   ^
  In file included from src/main.cpp:1:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h:213:
  In file included from /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdio.h:108:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
  #error architecture not supported
   ^
  In file included from src/main.cpp:1:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h:213:
  In file included from /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdio.h:108:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
  typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
          ^
  note: '__int128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
  typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
          ^
  note: '__int128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
  typedef __int32_t       __darwin_dev_t;         /* dev_t */
          ^
  note: '__int128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
  typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
          ^
  note: '__uint128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
  typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
          ^
  note: '__uint128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean '__uint128_t'?
  typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
          ^
  note: '__uint128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
  typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
          ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
  typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
          ^
  note: '__uint128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
  typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
          ^
  note: '__int128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
  typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
          ^
  note: '__int128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
  typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
          ^
  note: '__uint128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
  typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
          ^
  note: '__int128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
  typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
          ^
  note: '__uint128_t' declared here
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
  typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
          ^
  note: '__uint128_t' declared here
  In file included from src/main.cpp:1:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h:213:
  In file included from /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdio.h:108:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
  typedef __uint32_t      __darwin_wctype_t;
          ^
  note: '__uint128_t' declared here
  In file included from src/main.cpp:1:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h:13:
  In file included from /private/var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/pip-build-env-aw96eob0/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h:213:
  In file included from /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdio.h:108:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:75:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h:31:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
  #error architecture not supported
   ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  error: subprocess-exited-with-error

  × Building wheel for python-example (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/c8/00vmrkvs6r96cyth_mlr3dxr0000gn/T/tmpc19xvyla
  cwd: /Users/mustafa/scratch/python_example
  Building wheel for python-example (pyproject.toml) ... error
  ERROR: Failed building wheel for python-example
Failed to build python-example
ERROR: Could not build wheels for python-example, which is required to install pyproject.toml-based projects

Here's what I have tried to do so far:

  • Make sure pip and python are up to date, and in sync.
  • Run pip install --upgrade wheel setuptools

However, neither of these have seemed to help. I'm unsure if this is helpful or not, but I did clone the pybind11 repo itself and run the tests, they seem to run successfully.