cffi installation got failure on MacOs 12.5 with pip

172 views
Skip to first unread message

Mohammad hasan Farazmand

unread,
Aug 5, 2022, 6:41:16 AM8/5/22
to python-cffi

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 

Armin Rigo

unread,
Aug 6, 2022, 2:30:38 PM8/6/22
to pytho...@googlegroups.com
Hi,

On Fri, 5 Aug 2022 at 12:41, Mohammad hasan Farazmand
<m.h.fa...@gmail.com> wrote:
gcc-11: error: unrecognized command-line option '-iwithsysroot/usr/include/ffi'

Maybe "/opt/homebrew/bin/gcc-11" is gcc, and not clang. We don't
explicitly support gcc on MacOS, as far as I can tell. Contributions welcome.

A bientôt,
Armin Rigo

Mohammad hasan Farazmand

unread,
Aug 8, 2022, 3:37:51 AM8/8/22
to python-cffi
Hi, 
Ok, got it. So, I changed the default compiler in the bash profile and it worked 
I added the following lines to ~/.bash_profile
# Set Clang as the default compiler for the system 
export CC=clang 
export CFLAGS=-Qunused-arguments 
export CPPFLAGS=-Qunused-arguments

Reply all
Reply to author
Forward
0 new messages