通过ruby2.0.0在Windows上安装iconv时出错
通过ruby2.0.0在Windows上安装iconv时出错
我正在尝试安装iconv,但是当我运行以下命令时:
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。
答案 0 :(得分:5)
今晚我遇到了这个问题(Windows 7,Ruby 1.9.3)。我案例中的解决方案如下:
安装"完整包,除了来源"来自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的内容)他们没有工作他们自己,但一旦我运行设置,我就能安装宝石,所以也许这有帮助。我也有一个关于丢失的.gitignore的错误,但我忽略了,再次运行gem install ...它有效。
答案 1 :(得分:1)
我在Windows 10上遇到了同样的问题。感谢@Emma Burrows和@ZeWaren。以下为我工作,
/include
和/lib
复制到/bin
文件夹,对我来说C:\Program Files (x86)\GnuWin32\bin
C:\Program Files (x86)\GnuWin32\bin
gem install iconv -- --with-iconv-dir="C:\Program Files (x86)\GnuWin32\"
并在gem安装过程中快速将文件从/bin
转移到C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\iconv-1.0.4\ext\iconv