Reputation: 31
I am trying to install "cffi" with pip on MacOs 12.5 but I got an error
python : 3.8.10
pip : 22.2.2
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Command :
pip install cffi
Error
/opt/homebrew/bin/gcc-11 -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/libffi/include -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/opt/homebrew/Cellar/libffi/3.4.2/include -I/Users/faraz/.pyenv/versions/3.8.10/include/python3.8 -c c/_cffi_backend.c -o build/temp.macosx-12.5-arm64-3.8/c/_cffi_backend.o -iwithsysroot/usr/include/ffi
gcc-11: error: unrecognized command-line option '-iwithsysroot/usr/include/ffi'
error: command '/opt/homebrew/bin/gcc-11' failed with exit status 1
I also did some tips which mentioned in the following link but it didn't work for me. pip cffi package installation failed on osx
Upvotes: 0
Views: 861
Reputation: 31
After reading cffi
documents, I find out that,"/opt/homebrew/bin/gcc-11"
is gcc, and not clang and cffi
doesn't explicitly support gcc on MacOS.
So, I added the following lines to ~/.bash_profile
and it worked
# Set Clang as the default compiler for the system
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Upvotes: 2