gem install psych错误

4

我正在尝试安装一个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.3p327rails 3.2.12,操作系统是 OS X 10.8.2

我已经使用 rvm pkg install libyaml 安装了 libyaml 0.1.4

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


它正在寻找libyaml-devel库,请尝试安装该库,因为错误消息中建议这样做。 - bernabas
我想要@bernabas,但似乎libyaml-devel甚至不存在! - gibatronic
这对我很有效:port install libyaml +universal @gibatronic - bernabas
太好了!谢谢@bernabas!我之前不知道MacPorts...现在我通过它安装了libyaml,终于可以安装pysch gem了! - gibatronic
5个回答

10
apt-get install libyaml-dev

在我的情况下进行修复,适用于基于Debian 7系统的运行(很可能对Ubuntu也适用)。

它说它已经是最新版本了。 - Nick Roz

7

macOS:

brew install libyaml

它解决了我的gem update错误,尝试解析YAML步骤。

4

安装libyaml

port install libyaml +universal

2
这对我有用:
sudo apt-get install libyaml-dev

但是我不知道为什么?有人能解释一下这个命令是做什么的吗?

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接