First, install homebrew.
To build and install cffi
follow these steps:
- Install libffi
brew install pkg-config libffi
- Download and extract the
cffi
sources from https://pypi.org/project/cffi/#files
curl -OL https://files.pythonhosted.org/packages/00/9e/92de7e1217ccc3d5f352ba21e52398372525765b2e0c4530e6eb2ba9282a/cffi-1.15.0.tar.gz
tar -xzvf cffi-1.15.0.tar.gz
cd cffi-1.15.0
- Edit
setup.py
and add the path for libffi.pc toinclude_dirs
:
Get the path for libffi.pc:
find /opt/homebrew/ | grep "Cellar.*libffi.pc"
And the result should be something like:
/opt/homebrew//Cellar/libffi/3.4.2/lib/pkgconfig/libffi.pc
Edit setup.py
:
sources = ['c/_cffi_backend.c']
libraries = ['ffi']
include_dirs = ['/usr/include/ffi',
'/usr/include/libffi',
'/opt/homebrew//Cellar/libffi/3.4.2/lib/pkgconfig/libffi.pc']
# ...
- Run setup.py
sudo python3 setup.py install
azure-cli
requires an older version (<3.0.0) of cryptography, which in turn needs the OpenSSL library 1.1. We also need a Rust toolchain.
brew install [email protected] rust
Now install version 2.9.2 and reference the OpenSSL lib and include folders:
env LDFLAGS="-L$(brew --prefix [email protected])/lib" CFLAGS="-I$(brew --prefix [email protected])/include" pip3 install cryptography==2.9.2
pip3 install azure-cli