Comment installer ruby ​​gem libxml sans ‘échec extconf: libxml2 nécessaire’

J’essaie actuellement d’installer un bijou ruby ​​qui échoue car extconf dit qu’il a besoin de libxml, donc quand je suis ces instructions pour installer libxml (qui inclut ces instructions pour l’installation du kit ruby ​​dev), j’obtiens la sortie suivante:

$ gem install libxml-ruby --platform x86-mswin32-60 Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing libxml-ruby: ERROR: Failed to build gem native extension. c:/Ruby/bin/ruby.exe extconf.rb checking for socket() in -lsocket... no checking for gethostbyname() in -lnsl... no checking for atan() in -lm... yes checking for inflate() in -lz... no checking for inflate() in -lzlib... no checking for inflate() in -lzlib1... yes checking for iconv_open() in -liconv... no checking for libiconv_open() in -liconv... yes checking for xmlParseDoc() in -lxml2... no checking for xmlParseDoc() in -llibxml2... no checking for xmlParseDoc() in -lxml2... 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 --8<-- --with-xml2lib --without-xml2lib extconf failure: need libxml2. Install the library or try one of the following options to extconf.rb: --with-xml2-config=/path/to/xml2-config --with-xml2-dir=/path/to/libxml2 --with-xml2-lib=/path/to/libxml2/lib --with-xml2-include=/path/to/libxml2/include Gem files will remain installed in c:/Ruby/lib/ruby/gems/1.9.1/gems/libxml-ruby-2.2.2 for inspection. Results logged to c:/Ruby/lib/ruby/gems/1.9.1/gems/libxml-ruby-2.2.2/ext/libxml/gem_make.out 

Je suis sur une installation de Windows 7 x64 en utilisant mon minGW32-shell / git à installer. L’installation échoue avec le même message à partir de la commande windows ruby-powered promt.

fwiw:

 $ ruby -v ruby 1.9.2p290 (2011-07-09) [i386-mingw32] $ git --version git version 1.7.6.msysgit.0 $ gem -v 1.8.10 

Vous devriez essayer la gem nokogiri au lieu d’utiliser libxml-ruby . Il inclut les DLL libxml2 précompilées dans l’installation, vous n’avez donc pas à vous soucier de le créer vous-même.

L’API de Nokogiri est différente de celle de libxml-ruby, mais je suis sûr que vous trouverez les mêmes fonctionnalités.

Si libxml-ruby est une dépendance pour un autre joyau ou une autre application, vous ne pourrez probablement pas utiliser nokogiri. Qu’essayez-vous de faire?

J’ai eu ceci comme un commentaire, mais a été invité à le poster comme une réponse pour la visibilité:

La réponse à cette question a résolu mon problème: libxml-ruby n’a pas pu être chargé avec x86_64

Essayer de courir

 yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel 

Que ça devrait marcher