配置Fog以在Ruby on Rails项目中安装

时间:2019-05-15 01:04:18

标签: ruby-on-rails ruby rubygems config fog

我正在学习Rails上的ruby,并将我的项目托管在c9.io上。在迁移到Amazon AWS Cloud9的过程中,我必须将我的gem重新安装到我的项目中。我在尝试构建gem本机扩展时遇到配置错误。

在将“ gem install fog”输入命令行之前,我实际上不确定如何配置此gem。我曾尝试在Fog网站上搜索,但无法在其页面上找到信息。

错误是:

Building native extensions. This could take a while...
ERROR:  Error installing fog:
        ERROR: Failed to build gem native extension.

    current directory: /home/ubuntu/.rvm/gems/ruby-2.3.4/gems/ovirt-engine-sdk-4.3.0/ext/ovirtsdk4c
/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/ruby -r ./siteconf20190515-17400-2yzzer.rb extconf.rb
checking for xml2-config... no
*** 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.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
        --with-libxml2-config
        --without-libxml2-config
        --with-pkg-config
        --without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/ubuntu/.rvm/gems/ruby-2.3.4/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.3.0/mkmf.log

extconf failed, exit code 1

mkmf.log说:

find_executable: checking for xml2-config... -------------------- no

--------------------

"pkg-config --exists libxml2"
package configuration for libxml2 is not found

我只是不知道如何将此日志消息转换为我的代码库,因此我可以安装fog并继续使用我的应用程序。

2 个答案:

答案 0 :(得分:0)

尝试安装xml2开发包:

apt-get install libxml2-dev

这应该有效! (之后,您可能需要重新安装Ruby。)

答案 1 :(得分:0)

代替

gem 'fog'

使用

gem 'fog-aws'

在您的gem文件中,它应该可以工作。