Skip to content

OS X with Homebrew: set PKG_CONFIG_PATH

Bitbucket Importer requested to merge bitbucket/merged-pr-55 into branch/default

Created originally on Bitbucket by msabramo (Marc Abramowitz)

Was already merged in Bitbucket before import, marked as merged by the import user

so that it automatically finds a Homebrew-installed libffi

Without this, I get:

[marca@marca-mac2 cffi]$ python setup.py build
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
...
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -I/usr/include/ffi -I/usr/include/libffi -I/Libra
c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found
#include <ffi.h>
         ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

With this, I get:

[marca@marca-mac2 cffi]$ python setup.py build_ext -i
...
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -I/usr/local/Cellar/libffi/3.0.13/lib/libffi-3.0.
creating build/lib.macosx-10.6-intel-2.7
/usr/bin/clang -bundle -undefined dynamic_lookup -g -arch x86_64 build/temp.macosx-10.6-intel-2.7/c/_cffi_backend.o -L/usr/local/Cellar/libffi/3.0.13/lib -lffi -o build/lib
copying build/lib.macosx-10.6-intel-2.7/_cffi_backend.so ->
[marca@marca-mac2 cffi]$ ls -l _cffi_backend.so
-rwxr-xr-x+ 1 marca  staff  99844 Jan 27 17:11 _cffi_backend.so*
[marca@marca-mac2 cffi]$ python -c "import _cffi_backend; print(_cffi_backend)"
<module '_cffi_backend' from '_cffi_backend.so'>

Merge request reports

Loading