openSUSE 安裝compass,mkmf.rb can't find,checking for ffi.h...extconf.rb failed

安裝compass時,提示php

Fetching: sass-3.4.23.gem (100%)
Successfully installed sass-3.4.23
Fetching: ffi-1.9.18.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing compass:
    ERROR: Failed to build gem native extension.

    current directory: /usr/lib64/ruby/gems/2.1.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby.ruby2.1 -r ./siteconf20170501-19647-33n3uw.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib64/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/lib64/ruby/gems/2.1.0/gems/ffi-1.9.18 for inspection.
Results logged to /usr/lib64/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/ffi-1.9.18/gem_make.out

找資料有說明是缺乏mkmf,而mkmf是存在於ruby dev開發包中的,須要安裝 ruby1.9.1-dev版本,但是筆者的電腦中ruby的版本是:ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux-gnu]html

能夠經過zypper search命令查看相關的ruby安裝包linux

運行: zypper search ruby*sass

會列出和ruby相關的軟件包,在列表中有:ruby

i | ruby2.1                                                 | An In-> | 軟件包  
  | ruby2.1                                                 | An In-> | 源代碼包
  | ruby2.1-devel                                           | Devel-> | 軟件包  

-dev和-devel 後綴應該都屬於開發包,因此筆者運行了: zypper in ruby2.1-devel ui

運行的結果是:新安裝ruby2.1-devel 和升級libruby2_1-2_1 ruby2.1 ruby2.1-stdlib 3個軟件包this

再次嘗試運行: gem install compass,提示spa

ERROR:  Error installing compass:
    ERROR: Failed to build gem native extension.

    current directory: /usr/lib64/ruby/gems/2.1.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby.ruby2.1 -r ./siteconf20170501-19967-1fry11r.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

這提示的是缺乏 ffi.net

在上面執行的:zypper serch ruby* 命令的搜索結果中有:code

  | ruby2.1-rubygem-fastercsv-testsuite                     | Test -> | 軟件包  
  | ruby2.1-rubygem-ffi                                     | Ruby -> | 軟件包  
  | ruby2.1-rubygem-ffi-doc                                 | RDoc -> | 軟件包

運行: zypper in ruby2.1-rubygem-ffi


最後執行: gem install compass以後,安裝成功,暫時還不能直接運行compass命令,由於執行時,提示

If 'compass' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf compass

 

參考資料:

  1. zypper命令使用示例
  2. linux下各類*-dev或*-devel包的做用
  3. 安裝compass時出現ERROR: Failed to build gem native extension...... -- mkmf (Load Error)解決辦法
相關文章
相關標籤/搜索