Issue #9897 has been updated by Nobuyoshi Nakada.

Status changed from Open to Feedback

Does this work?

~~~diff
diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb
index 2190aa9..466d77e 100644
--- a/ext/fiddle/extconf.rb
+++ b/ext/fiddle/extconf.rb
@@ -7,7 +7,8 @@ dir_config 'libffi'
 pkg_config("libffi")
 if ver = pkg_config("libffi", "modversion")
   ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored.
-  $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver.split('.') }})
+  ver = (ver.split('.') + [0,0])[0,3]
+  $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver }})
 end
 
 unless have_header('ffi.h')
~~~

----------------------------------------
Bug #9897: Build fails for fiddle with libffi version 3.1
https://bugs.ruby-lang.org/issues/9897#change-47026

* Author: Juergen Daubert
* Status: Feedback
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: build
* Target version: next minor
* ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
ext/fiddle/extconf.rb expects a 3-digit version string from the libffi pkg-config.
Latest libffi is version 3.1 and building of fiddle fails because version is only 2-digit.



-- 
https://bugs.ruby-lang.org/