oconnor663 / blake3-py

Python bindings for the BLAKE3 cryptographic hash function
Other
139 stars 12 forks source link

Apple Silicon (M1 CPU) support? #31

Closed ThomasWaldmann closed 2 years ago

ThomasWaldmann commented 2 years ago

This refers to the stuff in c_impl/:

Didn't get it to work on macOS / M1.

  Preparing metadata (setup.py) ... done
Installing collected packages: blake3-experimental-c
  Running setup.py develop for blake3-experimental-c
    Running command /Users/tw/w/blake3-py-env/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/tw/w/blake3-py/c_impl/setup.py'"'"'; __file__='"'"'/Users/tw/w/blake3-py/c_impl/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
    portable code only
    running develop
    /Users/tw/w/blake3-py-env/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    /Users/tw/w/blake3-py-env/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running egg_info
    creating blake3_experimental_c.egg-info
    writing manifest file 'blake3_experimental_c.egg-info/SOURCES.txt'
    writing manifest file 'blake3_experimental_c.egg-info/SOURCES.txt'
    running build_ext
    creating build
    creating build/temp.macosx-12-arm64-3.9
    creating build/temp.macosx-12-arm64-3.9/vendor
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DSETUP_PY_VERSION=\"0.0.1\" "-DSETUP_PY_DESCRIPTION=\"experimental bindings for the BLAKE3 C implementation, API-compatible with the Rust-based blake3 module\"" -Ivendor -I/Users/tw/w/blake3-py-env/include -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c blake3module.c -o build/temp.macosx-12-arm64-3.9/blake3module.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DSETUP_PY_VERSION=\"0.0.1\" "-DSETUP_PY_DESCRIPTION=\"experimental bindings for the BLAKE3 C implementation, API-compatible with the Rust-based blake3 module\"" -Ivendor -I/Users/tw/w/blake3-py-env/include -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c vendor/blake3.c -o build/temp.macosx-12-arm64-3.9/vendor/blake3.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DSETUP_PY_VERSION=\"0.0.1\" "-DSETUP_PY_DESCRIPTION=\"experimental bindings for the BLAKE3 C implementation, API-compatible with the Rust-based blake3 module\"" -Ivendor -I/Users/tw/w/blake3-py-env/include -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c vendor/blake3_dispatch.c -o build/temp.macosx-12-arm64-3.9/vendor/blake3_dispatch.o
    vendor/blake3_dispatch.c:241:3: warning: code will never be executed [-Wunreachable-code]
      blake3_hash_many_portable(inputs, num_inputs, blocks, key, counter,
      ^~~~~~~~~~~~~~~~~~~~~~~~~
    vendor/blake3_dispatch.c:85:5: warning: unused function 'get_cpu_features' [-Wunused-function]
        get_cpu_features() {
        ^
    2 warnings generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DSETUP_PY_VERSION=\"0.0.1\" "-DSETUP_PY_DESCRIPTION=\"experimental bindings for the BLAKE3 C implementation, API-compatible with the Rust-based blake3 module\"" -Ivendor -I/Users/tw/w/blake3-py-env/include -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c vendor/blake3_portable.c -o build/temp.macosx-12-arm64-3.9/vendor/blake3_portable.o
    creating build/lib.macosx-12-arm64-3.9
    clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk build/temp.macosx-12-arm64-3.9/blake3module.o build/temp.macosx-12-arm64-3.9/vendor/blake3.o build/temp.macosx-12-arm64-3.9/vendor/blake3_dispatch.o build/temp.macosx-12-arm64-3.9/vendor/blake3_portable.o -o build/lib.macosx-12-arm64-3.9/blake3.cpython-39-darwin.so
Successfully installed blake3-experimental-c-0.0.1
(blake3-py-env) tw@mba2020 c_impl % python3
Python 3.9.10 (main, Jan 15 2022, 11:40:53) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import blake3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/tw/w/blake3-py/c_impl/blake3.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_blake3_hash_many_neon'