Search code examples
rubyrubygemscygwinnokogirilibiconv

'libiconv is missing' error when installing Nokogiri on Cygwin


I'm trying to install Nokogiri 1.6.3.1 on Windows in Cygwin, and am getting the error:

gem install nokogiri -v '1.6.3.1'

libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

libiconv is installed in the Cygwin package manager. The link above suggests upgrading Rubygems to 2.5, but doing so had no effect.

Environment:

  • Windows Server 2012 R2 64-bit
  • Cygwin 2.3.1
  • Ruby 2.0.0p643 (via RVM)

Solution

  • Eventually figured this out myself ... had to direct the installation to use the system's pre-installed dependencies rather than compiling them, and tell it where the libxml2 dev headers were located. This was succcessful for me:

    gem install nokogiri -v '1.6.3.1' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2