宝石安装心理错误

时间:2013-02-20 17:55:01

标签: ruby-on-rails psych

我正在尝试捆绑安装rails项目,但我被卡住了...... 当我尝试运行gem install psych时,我得到的就是:

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

        /Users/gibatronic/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for yaml.h... no
yaml.h is missing. Try 'port install libyaml +universal' or 'yum install libyaml-devel'
*** 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=/Users/gibatronic/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
    --with-libyaml-dir
    --without-libyaml-dir
    --with-libyaml-include
    --without-libyaml-include=${libyaml-dir}/include
    --with-libyaml-lib
    --without-libyaml-lib=${libyaml-dir}/lib


Gem files will remain installed in /Users/gibatronic/.rvm/gems/ruby-1.9.3-p327/gems/psych-1.3.4 for inspection.
Results logged to /Users/gibatronic/.rvm/gems/ruby-1.9.3-p327/gems/psych-1.3.4/ext/psych/gem_make.out

我在ruby 1.9.3p327

上使用rails 3.2.12正在运行OS X 10.8.2

我已经使用libyaml 0.1.4

安装了rvm pkg install libyaml

我真的不知道该怎么做了!

3 个答案:

答案 0 :(得分:2)

安装libyaml

port install libyaml +universal

答案 1 :(得分:2)

apt-get install libyaml-dev

我的案例中的修复程序是在基于Debian 7的系统下运行的(Ubuntu可能相同)

答案 2 :(得分:0)

在我的情况下,我必须设置CFLAGS和LDFLAGS变量:

# ensure libyaml is installed
port install libyaml +universal

# if you like you can check the location of the installied files (especially the .h file)
# port contents libyaml

# now configure with these options
CFLAGS="-I/opt/local/include/ "  LDFLAGS="-L/opt/local/lib/" ./configure
make
sudo make install