"pkg-config --exists libffi" | pkg-config --libs libffi => "-lffi\n" "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.2.7 " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return !!argv[argc]; 6: } /* end */ "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.2.7 -lffi " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return !!argv[argc]; 6: } /* end */ | pkg-config --cflags-only-I libffi => "-I/usr/include/ffi\n" | pkg-config --cflags-only-other libffi => "\n" | pkg-config --libs-only-l libffi => "-lffi\n" package configuration for libffi incflags: -I/usr/include/ffi cflags: ldflags: libs: -lffi have_library: checking for ffi_prep_closure_loc() in -lffi... -------------------- no "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/usr/include/ffi -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lffi -lruby.2.7 -lffi -lffi " conftest.c:16:57: error: use of undeclared identifier 'ffi_prep_closure_loc' int t(void) { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure_loc; return !p; } ^ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: int t(void) { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure_loc; return !p; } /* end */ "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/usr/include/ffi -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lffi -lruby.2.7 -lffi -lffi " Undefined symbols for architecture x86_64: "_ffi_prep_closure_loc", referenced from: _t in conftest-60f65a.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: extern void ffi_prep_closure_loc(); 17: int t(void) { ffi_prep_closure_loc(); return 0; } /* end */ -------------------- have_library: checking for ffi_prep_closure_loc() in -llibffi... -------------------- no "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/usr/include/ffi -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lffi -lruby.2.7 -llibffi -lffi " conftest.c:16:57: error: use of undeclared identifier 'ffi_prep_closure_loc' int t(void) { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure_loc; return !p; } ^ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: int t(void) { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure_loc; return !p; } /* end */ "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/usr/include/ffi -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lffi -lruby.2.7 -llibffi -lffi " ld: library not found for -llibffi clang: error: linker command failed with exit code 1 (use -v to see invocation) checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: extern void ffi_prep_closure_loc(); 17: int t(void) { ffi_prep_closure_loc(); return 0; } /* end */ -------------------- have_library: checking for ffi_prep_closure_loc() in -llibffi-8... -------------------- no "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/usr/include/ffi -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lffi -lruby.2.7 -llibffi-8 -lffi " conftest.c:16:57: error: use of undeclared identifier 'ffi_prep_closure_loc' int t(void) { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure_loc; return !p; } ^ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: int t(void) { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure_loc; return !p; } /* end */ "clang -o conftest -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/x86_64-darwin17 -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/backward -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include/ruby-2.7.0 -I. -I/usr/include/ffi -I/Users/kentayamamoto/.rbenv/versions/2.7.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -L. -L/Users/kentayamamoto/.rbenv/versions/2.7.0/lib -fstack-protector-strong -L/usr/local/lib -lffi -lruby.2.7 -llibffi-8 -lffi " ld: library not found for -llibffi-8 clang: error: linker command failed with exit code 1 (use -v to see invocation) checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: extern void ffi_prep_closure_loc(); 17: int t(void) { ffi_prep_closure_loc(); return 0; } /* end */ -------------------- extconf.h is: /* begin */ 1: #ifndef EXTCONF_H 2: #define EXTCONF_H 3: #define HAVE_FFI_PREP_CIF_VAR 1 4: #define USE_INTERNAL_LIBFFI 1 5: #endif /* end */