I’ve followed every step on TSU’s post on installing ruby, but I’m still seeing this problem when I run
gem install rails
:
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 ***
however for some reason
sudo gem install rails
works, but
rails
as a command doesn’t work.
doing a find on the possible location of rails I believe it’s here: /usr/lib64/ruby/gems/2.1.0/gems/railties-4.2.3/bin/ however, it gives this error when I run it:
~/.rbenv/versions/2.2.2/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails/cli (LoadError)
from ~/.rbenv/versions/2.2.2/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/gems/2.1.0/gems/railties-4.2.3/bin/rails:9:in `<main
When you use “gem install” you’re not installing from the openSUSE repos, you’re installing from the official Ruby repos, the result is that because you’re using two different package management systems you’re not going to ensure that everything is consistent and wired up properly.
If you want to install anything from the Ruby repos, I suggest that you also install Ruby from those repos. I describe how to set up Ruby from the official Ruby repos (and all other options) in a wiki article I wrote. Following this, the “rails” command should work. https://en.opensuse.org/User:Tsu2/Install_Ruby
If you want to use the Ruby that’s provided to you using Ruby from openSUSE repos, I’d recommend you use gems from the openSUSE repos as well., you can list avaiable gems in the openSUSE repos with the following command. You use zypper or YAST to install these re-packaged gems. Notice that there should also be a pre-package rails but should be invoked differently.
I eventually got mine to work through reading the error messages more carefully, but thank you for your help.
In my case I actually did install ruby from your article https://en.opensuse.org/User:Tsu2/Install_Ruby using rbenv, and afterwards I arrived at such a problem. Yesterday I kept on trying and eventually I was able to get bundle install working in a project by following the error messages and following a StackOverFlow question.
BTW - in my guide, I describe “bundle install” as one of the packages which has to be installed from the openSUSE Ruby repo, and not from the official Ruby repos. The one from the openSUSE Ruby repo will work immediately without any fixes.