本文介绍了在ruby2.0.0的Windows上安装iconv时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ruby2.0.0的Windows上安装iconv时发生错误
在ruby2.0.0上的Windows上安装iconv时发生错误

我正在尝试安装iconv,但是当我运行以下命令时:

Error while installing iconv on windows by ruby2.0.0
Error while installing iconv on windows by ruby2.0.0

I'm trying to install the iconv , but when I run the following command:

gem install iconv 

我的结果:

Temporarily enhancing Path to include DevKit...
Building native extensions. This could take a while...
Error : Error installing iconv:
    ERROR: Failed to build gem native extension.

C:/Ruby/Ruby200/bin/ruby.exe -r ./siteconf20150217-3212-i8hzmh.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.

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=C:/Ruby/Ruby200/bin/ruby
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/
    --enable-config-charset
    --disable-config-charset
    --with-config-charset
    --without-config-charset
    --with-iconvlib
    --without-iconvlib

extconf failed, exit code 1

请帮助我!!!!THX.

please help me!!!!THX.

推荐答案

今天晚上我遇到了这个问题(Windows 7,Ruby 1.9.3).在我的情况下,解决方案如下:

I had this problem this evening (Windows 7, Ruby 1.9.3). The solution in my case was as follows:

  1. http://gnuwin32.sourceforge安装源代码之外的完整软件包" .net/packages/libiconv.htm

运行gem install iconv -v '1.0.4' -- --with-iconv-dir=/path/to/GnuWin32

如果这行不通,我也首先按照此处的说明进行操作: http://donpepeto.com/2014/09/20/fixing-c-libraries-on-your-rubyrails-install-on-windows/(正在复制(GnuWin32安装中/bin,/include和/lib的内容)无法单独工作,但是一旦我运行了安装程序,便能够安装gem,因此也许有所帮助.我还遇到了一个有关缺少.gitignore的错误,但我忽略了这一点,再次运行了gem install ...并且成功了.

If that doesn't work, I also followed the instructions here first: http://donpepeto.com/2014/09/20/fixing-c-libraries-on-your-rubyrails-install-on-windows/ (Copying the contents of /bin, /include and /lib from the GnuWin32 install) They didn't work on their own, but once I'd run the setup, I was able to install the gem, so maybe that helped. I also got an error about a missing .gitignore, but I ignored that, ran gem install... again and it worked.

这篇关于在ruby2.0.0的Windows上安装iconv时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 23:53