zoukankan      html  css  js  c++  java
  • openSUSE 安装compass,mkmf.rb can't find,checking for ffi.h...extconf.rb failed

    安装compass时,提示

    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]

    可以通过zypper search命令查看相关的ruby安装包

    运行: zypper search ruby*

    会列出和ruby相关的软件包,在列表中有:

    i | ruby2.1                                                 | An In-> | 软件包  
      | ruby2.1                                                 | An In-> | 源代码包
      | ruby2.1-devel                                           | Devel-> | 软件包  

    -dev和-devel 后缀应该都属于开发包,所以笔者运行了: zypper in ruby2.1-devel 

    运行的结果是:新安装ruby2.1-devel 和升级libruby2_1-2_1 ruby2.1 ruby2.1-stdlib 3个软件包

    再次尝试运行: gem install compass,提示

    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

    在上面执行的:zypper serch ruby* 命令的搜索结果中有:

      | 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)解决办法
  • 相关阅读:
    Linux命令:head
    Linux命令:less
    分布式锁的实现(java)
    mysql大数据量使用limit分页,随着页码的增大,查询效率越低下。(转载)
    SpringBoot实现热加载方式
    报表设计细节
    Pentaho Report Designer 数据大于某值显示红色
    Centos7更改yum源与更新系统
    Centos7安装配置NFS服务和挂载
    centos7上搭建ftp服务器(亲测可用)
  • 原文地址:https://www.cnblogs.com/fsong/p/6794055.html
Copyright © 2011-2022 走看看