Actions
Bug #9897
closedBuild fails for fiddle with libffi version 3.1
    Bug #9897:
    Build fails for fiddle with libffi version 3.1
  
Description
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.
        
           Updated by nobu (Nobuyoshi Nakada) over 11 years ago
          Updated by nobu (Nobuyoshi Nakada) over 11 years ago
          
          
        
        
      
      - Status changed from Open to Feedback
Does this work?
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')
        
           Updated by jue (Juergen Daubert) over 11 years ago
          Updated by jue (Juergen Daubert) over 11 years ago
          
          
        
        
      
      Yes, that works :) Thank you very much for the quick fix.
        
           Updated by nobu (Nobuyoshi Nakada) over 11 years ago
          Updated by nobu (Nobuyoshi Nakada) over 11 years ago
          
          
        
        
      
      - Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED
        
           Updated by nobu (Nobuyoshi Nakada) over 11 years ago
          Updated by nobu (Nobuyoshi Nakada) over 11 years ago
          
          
        
        
      
      - Status changed from Feedback to Closed
- % Done changed from 0 to 100
Applied in changeset r46485.
fiddle/extconf.rb: supply 0
- ext/fiddle/extconf.rb: supply 0 to fill RUBY_LIBFFI_MODVERSION
 with 3-digit. libffi 3.1 returns just 2-digit.
 [ruby-core:62920] [Bug #9897]
        
           Updated by nagachika (Tomoyuki Chikanaga) over 11 years ago
          Updated by nagachika (Tomoyuki Chikanaga) over 11 years ago
          
          
        
        
      
      - Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE
Backported into ruby_2_1 branch at r46609.
        
           Updated by usa (Usaku NAKAMURA) over 11 years ago
          Updated by usa (Usaku NAKAMURA) over 11 years ago
          
          
        
        
      
      - Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONTNEED, 2.1: DONE
Actions