我无法安装iconv

时间:2016-08-02 11:26:34

标签: ruby-on-rails ruby rubygems iconv

当我运行gem install iconv时,它失败如下:

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

    current directory: /home/myname/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/iconv-1.0.4/ext/iconv
/home/myname/local/rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160802-38989-1ie1z24.rb extconf.rb
checking for rb_enc_get() in ruby/encoding.h... yes
checking for rb_sys_fail_str() in ruby.h... yes
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... 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.

我不知道如何解决这个问题。 我该怎么办?

1 个答案:

答案 0 :(得分:2)

如果您的主机正在运行Ubuntu / Debian:

sudo aptitude install libc6-dev

如果是Fedora / Redhat:

sudo yum install libc6-devel

然后使用gem install iconv重试。所有学分都归@ lars-haugseth所有。