Missing ffi_prep_closure for ffi-1.13.1 gem

Today, I tried to setup a project that is using bootstrap gem, which got dependency for ffi. And when I tried to do bundle install , I got following error:

Function.c:852:17: error: implicit declaration of function 'ffi_prep_closure_loc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ffiStatus = ffi_prep_closure_loc(code, &fnInfo->ffi_cif, callback_invoke, closure, code);
Function.c:852:17: note: did you mean 'ffi_prep_closure'?
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/ffi/ffi.h:269:1: note: 'ffi_prep_closure' declared here
1 error generated.
make: *** [Function.o] Error 1
make failed, exit code 2

Did a quick search online, and found a temporary solution from this issue:

gem install ffi -- --disable-system-libffi

Turns out ffi-1.13.1 is using ffi_prep_closure_loc() and system-libffi for Mac doesn’t have that function.

a RoR dev, a rock climber

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store