Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Silicon build not supported. #245

Open
ibrewster opened this issue Dec 19, 2023 · 2 comments
Open

Apple Silicon build not supported. #245

ibrewster opened this issue Dec 19, 2023 · 2 comments

Comments

@ibrewster
Copy link

When attempting to install bjoern on my apple silicon M1 mac using pip install bjoern the build fails with a number of "Architecture not supported" errors (see full output below). I can get it to build and install by prepending ARCHFLAGS="-arch x86_64" to the pip install command, but then the installed binary can't be imported due to "incompatible architecture" issues.

Collecting bjoern
  Using cached bjoern-3.2.2.tar.gz (45 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: bjoern
  Building wheel for bjoern (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for bjoern (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [122 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      copying bjoern.py -> build/lib.macosx-10.9-universal2-cpython-311
      running build_ext
      building '_bjoern' extension
      creating build/temp.macosx-10.9-universal2-cpython-311
      creating build/temp.macosx-10.9-universal2-cpython-311/bjoern
      creating build/temp.macosx-10.9-universal2-cpython-311/http-parser
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -g --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I /usr/local/Cellar/openssl@1.1/1.1.1l_1/include -arch arm64 -DSIGNAL_CHECK_INTERVAL=0.1 -DWANT_SIGNAL_HANDLING=yes -DWANT_SIGINT_HANDLING=yes -Ihttp-parser -Istatsd-c-client -I/usr/include/libev -I/opt/local/include -I/opt/homebrew/include -I/usr/local/include -I/Users/israel/Development/iTunesControl/env/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c bjoern/_bjoernmodule.c -o build/temp.macosx-10.9-universal2-cpython-311/bjoern/_bjoernmodule.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
      In file included from bjoern/_bjoernmodule.c:1:
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
      In file included from /usr/local/include/stdlib.h:63:
      In file included from /usr/local/include/_types.h:27:
      In file included from /usr/local/include/sys/_types.h:33:
      /usr/local/include/machine/_types.h:36:2: error: architecture not supported
      #error architecture not supported
       ^
      In file included from bjoern/_bjoernmodule.c:1:
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
      In file included from /usr/local/include/stdlib.h:63:
      In file included from /usr/local/include/_types.h:27:
      /usr/local/include/sys/_types.h:94:9: error: unknown type name '__int64_t'
      typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
              ^
      /usr/local/include/sys/_types.h:95:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
              ^~~~~~~~~
              __int128_t
      note: '__int128_t' declared here
      /usr/local/include/sys/_types.h:96:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_dev_t;         /* dev_t */
              ^~~~~~~~~
              __int128_t
      note: '__int128_t' declared here
      /usr/local/include/sys/_types.h:99:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      /usr/local/include/sys/_types.h:100: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*/
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      /usr/local/include/sys/_types.h:101:9: error: unknown type name '__uint64_t'
      typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
              ^
      /usr/local/include/sys/_types.h:107:9: error: unknown type name '__darwin_natural_t'
      typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
              ^
      /usr/local/include/sys/_types.h:109:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
      typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      /usr/local/include/sys/_types.h:110:9: error: unknown type name '__int64_t'
      typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
              ^
      /usr/local/include/sys/_types.h:111:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
              ^~~~~~~~~
              __int128_t
      note: '__int128_t' declared here
      /usr/local/include/sys/_types.h:131:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      /usr/local/include/sys/_types.h:132:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
              ^~~~~~~~~
              __int128_t
      note: '__int128_t' declared here
      /usr/local/include/sys/_types.h:133:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      /usr/local/include/sys/_types.h:134:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      In file included from bjoern/_bjoernmodule.c:1:
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
      In file included from /usr/local/include/stdlib.h:63:
      /usr/local/include/_types.h:42:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_wctype_t;
              ^~~~~~~~~~
              __uint128_t
      note: '__uint128_t' declared here
      In file included from bjoern/_bjoernmodule.c:1:
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
      In file included from /usr/local/include/stdlib.h:65:
      In file included from /usr/local/include/sys/wait.h:116:
      In file included from /usr/local/include/sys/signal.h:81:
      /usr/local/include/machine/signal.h:36:2: error: architecture not supported
      #error architecture not supported
       ^
      In file included from bjoern/_bjoernmodule.c:1:
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
      In file included from /usr/local/include/stdlib.h:65:
      In file included from /usr/local/include/sys/wait.h:116:
      In file included from /usr/local/include/sys/signal.h:148:
      In file included from /usr/local/include/sys/_structs.h:57:
      /usr/local/include/machine/_structs.h:33:2: error: architecture not supported
      #error architecture not supported
       ^
      In file included from bjoern/_bjoernmodule.c:1:
      In file included from /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/Python.h:23:
      In file included from /usr/local/include/stdlib.h:65:
      In file included from /usr/local/include/sys/wait.h:116:
      In file included from /usr/local/include/sys/signal.h:148:
      /usr/local/include/sys/_structs.h:78:2: error: unknown type name '__darwin_size_t'
              __darwin_size_t ss_size;        /* signal stack length */
              ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for bjoern
Failed to build bjoern
ERROR: Could not build wheels for bjoern, which is required to install pyproject.toml-based projects
@DanielBooysenjr
Copy link

I have a similar issue, are there any fixes in the pipeline? Running Windows

@ibrewster
Copy link
Author

I took another look at this today, and managed to get bjoern to compile on my Apple Silicon M1 Mac by:

  1. Using the homebrew installed version of python3.11 rather than the python package installed version
  2. Running the following commands:
xcrun --show-sdk-path
CFLAGS="-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" pip install -I --no-cache-dir bjoern

where the argument to -I in the CFLAGS environment variable is the output of the xcrun --show-sdk-path command with /usr/include appended to it.

So apparently the issue is more environment related than bjoern specifically, though bjoern does something differently than at least some other packages that triggers the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants