libffi

Joshua Root jmr at macports.org
Mon Jun 29 07:58:22 UTC 2020


Curtis Matz wrote:
> I’ve installed libffi but I’m trying to compile and it says it can’t find ffi.h.  How do I tell my compiler which happens to be gcc9 to look in /opt/local for the header file?
> 
>> port installed | grep libffi
>   libffi @3.2.1_0 (active)
> 
> src/rtlib/thread_call.c:33:10: fatal error: ffi.h: No such file or directory
>    33 | #include <ffi.h>
>       |          ^~~~~~~
> compilation terminated.
> make: *** [src/rtlib/obj/darwin-x86_64/thread_call.o] Error 1

This is the problem pkg-config was designed to solve. Compile with
`pkg-config --cflags libffi` and link with `pkg-config --libs libffi`.

It happens that libffi doesn't put its header directly in
/opt/local/include, but pkg-config knows that so you don't have to.

- Josh


More information about the macports-users mailing list