Error - "gem install rails" - missing libxml2

I worked with the Rails installation instructions ( http://railsapps.imtqy.com/installrubyonrails-mac.html ) and everything was fine until I got to the gem install rails part in the New Rails application. When I ran, I lost libxml2. Here's the magazine: http://codecascade.com/sIjhQ/raw

I had similar problems fixing nokogiri and the only way I was able to solve it was to

 gem install nokogiri -- --use-system-libraries 

I am on OS X 10.10.2. I also have RubyMine, if that is potentially important.

+6
source share
8 answers

I had the same problem and was able to solve it as follows:

The Nokogiri installation separately worked only when using the system libraries:

 gem install nokogiri -- --use-system-libraries 

... but still failed to complete bundle install . Therefore, simply configure bundler to also create Nokogiri using the system libraries:

 bundle config build.nokogiri --use-system-libraries 
+7
source

You do not have the required library, and it is so simple for Google’s solution:

  brew install libxml2 
+6
source

Try using this:

 sudo gem install rails -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/ 
+4
source

I had the same problem: on Debian, this was just the problem of the lack of the "dev" libraries, possibly to compile the sources during installation (I assume). I solved this by installing (via apt-get or aptitude) the following packages:

  • Libxml2-dev
  • libxslt1-dev
+1
source

For some reason, the nokogiri build process for libxml2 will result in an incorrect build version.

Instead of lib/ it will go lib64/ . Nokogiri will then search for it in the wrong directory.

More details here: https://github.com/sparklemotion/nokogiri/issues/1334

0
source

This worked for me, as Simar mentioned.

 sudo gem install rails -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/ 

And if you have any problems, install it on a Mac, please check here. https://gorails.com/setup/osx/10.11-el-capitan

Also, if you could not find / usr / local / Cellar / libxml 2 / existing, you might need his homework.

 brew install libxml2 

If you install it on a recently installed X EL CAPITAN OS, like me, you will probably find that homebrew tells you that libxml2 is already installed and brew will not replace the existing libxml2, it recently installed the one located in / usr / local / Cellar / libxml 2 /, which we must link to the libraries. Because the system default libxml2 will not bind successfully.

0
source

This worked for me ( based on this Github thread ):

 gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/ 

As a note, my problem was this:

 ... checking for main() in -llzma... yes checking for xmlParseDoc() in libxml/parser.h... no checking for xmlParseDoc() in -lxml2... no checking for xmlParseDoc() in -llibxml2... no ----- libxml2 is missing. Please locate mkmf.log to investigate how it is failing. ----- *** 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=/Users/seanshadmand/.rvm/rubies/ruby-2.1.1/bin/ruby --help --clean --use-system-libraries --enable-static --disable-static --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib --enable-cross-build --disable-cross-build --with-xml2lib --without-xml2lib --with-libxml2lib --without-libxml2lib To see why this extension failed to ... extconf failed, exit code 1 
0
source

I had the same problem when I try:

 gem install libxml-ruby -v '3.0.0 

Follow these steps to resolve the issue on Mac:

 gem update --system xcode-select --install gem install nokogiri 

See nokogiri installation for more details.

0
source

Source: https://habr.com/ru/post/983951/


All Articles