For compiled libraries like libyaml, where does Ruby (or RVM) search on the file system to load or enable them?

Operating System: CentOS 6.2 x86_64
I apologize for the indentation was erratic. This is my first SO post, and I'm new to setting up servers. I study, although I will tell you in detail about the steps that I took to try to solve this, and also where I was looking for help. I am a beginner young web developer, and I work on a server that someone else set up, so this whole experience is new to me.

I am preparing a linode that I recently purchased to run a rails application. I completed the initial installation guide presented here http://blog.blenderbox.com/2011/01/07/installing-rvm-ruby-rails-passenger-nginx-on-centos/ , and also changing the step:
sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )
To reflect the changes recommended in this SO RVM thread, system-wide installation of script url broken - what is a replacement?

 bash -c "bash <( curl -L https://github.com/wayneeseguin/rvm/raw/1.3.0/contrib/install-system-wide ) --version '1.3.0'" 

I settled on installing ngix because I am using Apache2. I also had to run rvm requirements and install the necessary packages before installing the rails. Here libyaml was set for installation, and the first error occurred while trying to install it. However, yum reported that it does not exist. The initial installation of RVM and Gems seemed to work, but I had a problem with the lack of Gems "Psych", and then asked to install libyaml:

/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in '<top (required)>': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.

So I first tried installing libyaml via Yum, but got this error:

 yum install libyaml Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: centosmirror.quintex.com * extras: centosmirror.quintex.com * updates: centosmirror.quintex.com Setting up Install Process No package libyaml available. Error: Nothing to do 


Trying to install libyaml-devel and libyaml-dev had the same problem.

After doing some research, I found this blog post from CollectiveIdea that detailed the same problem and suggested a solution. Blog post on a collective idea I followed the instructions and completed the installation without any setup or configuration issues. Then I performed a ruby ​​reinstall. I was still presented with the same warning and searched further in SO for similar questions. As described in the answers to this question regarding the same problem, how to solve the “ruby installation went missing” error? Using:

 rvm pkg install libyaml Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives Extracting yaml-0.1.4.tar.gz to /usr/local/rvm/src Prepare yaml in /usr/local/rvm/src/yaml-0.1.4. Configuring yaml in /usr/local/rvm/src/yaml-0.1.4. Compiling yaml in /usr/local/rvm/src/yaml-0.1.4. Installing yaml to /usr/local/rvm/usr 

Please note that it required to reinstall all rubies:

It was recommended to reinstall everything through RVM, and I also followed these instructions.

 rvm reinstall all --force Removing /usr/local/rvm/src/ruby-1.9.3-p194... Removing /usr/local/rvm/rubies/ruby-1.9.3-p194... mv: overwrite `/usr/local/rvm/user/installs'? y No binary rubies available for: ///ruby-1.9.3-p194. Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)... ruby-1.9.3-p194 - #downloading ruby-1.9.3-p194, this may take a while depending on your connection... ruby-1.9.3-p194 - #extracting ruby-1.9.3-p194 to /usr/local/rvm/src/ruby-1.9.3-p194 ruby-1.9.3-p194 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p194 ruby-1.9.3-p194 - #configuring ruby-1.9.3-p194 - #compiling ruby-1.9.3-p194 - #installing 

Even after that, the warning is still present. I checked the ruby ​​installation on ruby -v and it is actually installed. Libyaml files have been installed, they are here:

 [ root@li543-100 ~]# ls -la /usr/local/lib total 19620 drwxr-xr-x 5 root root 4096 Oct 1 15:40 . drwxr-xr-x 13 root root 4096 Oct 1 05:55 .. drwxr-xr-x 2 root root 4096 Oct 1 06:34 include lrwxrwxrwx 1 root root 16 Oct 1 15:40 libruby.so -> libruby.so.1.9.1 lrwxrwxrwx 1 root root 16 Oct 1 15:40 libruby.so.1.9 -> libruby.so.1.9.1 -rwxr-xr-x 1 root root 7457107 Oct 1 06:42 libruby.so.1.9.1 -rw-r--r-- 1 root root 11633486 Oct 1 15:39 libruby-static.a lrwxrwxrwx 1 root root 18 Oct 1 06:37 libyaml-0.so.2 -> libyaml-0.so.2.0.2 -rwxr-xr-x 1 root root 358698 Oct 1 06:37 libyaml-0.so.2.0.2 -rw-r--r-- 1 root root 565584 Oct 1 06:37 libyaml.a -rwxr-xr-x 1 root root 953 Oct 1 06:37 libyaml.la lrwxrwxrwx 1 root root 18 Oct 1 06:37 libyaml.so -> libyaml-0.so.2.0.2 drwxr-xr-x 2 root root 4096 Oct 1 06:45 pkgconfig drwxr-xr-x 6 root root 4096 Oct 1 06:45 ruby -rw-rw-r-- 1 root rvm 194 Oct 1 05:55 rvm 

You can also see that I tried to create a symbolic link between / usr / local / lib and / usr / local / rvm / lib under the assumption that the yaml files could be installed in the wrong directory or that rvm did not look in the corresponding directory for them. I ran that ruby ​​and thought that Ruby was in the / rvm directory, which might be a problem:

 [ root@li543-100 ~]# which ruby /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby [1]: http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/ 

It did not help. Therefore, I am on the fence, where I made a mistake or what I’m not looking for.
1: I made an installation error by placing the files in the wrong directory?
2: Ruby looking for libyaml files in another directory?
3: When I followed the blog posts, I was not able to add any feature of the system to install?

I redid CentOS on my linode 4 times, hoping that this was a problem with me not matching the scripts accordingly, I am on the fifth deployment with the same problem. I'm currently looking for SO for number 2, and hopefully my post is not inappropriate, as this is explicitly allowed elsewhere. I would appreciate any help you could provide.

EDIT:

So, after redistributing the CentOS6.2 OS, I ran the modified setup as follows:

 yum -y install git yum -y install curl groupadd rvm usermod -a -G rvm root bash -c "bash <( curl -L https://github.com/wayneeseguin/rvm/raw/1.3.0/contrib/install-system-wide) -- version'1.3.0'" echo '[[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" #This loads RVM into a shell session' >> ~/.bash_profile source ~/.bash_profile yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel rvm get head yum install readline readline-devel rvm package install libyaml -v rvm install 1.9.3 -v rvm use 1.9.3 ruby -v 

This also still encounters an error:

 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. 

Running previous commands to get libyaml from RVM and reinstalling all rubies doesn't seem to fix the problem for me. When rvm is running, reinstall all --force, will the installation of the previous libyaml package be removed, rewritten or replaced? It seems to be in the correct directories.

 [ root@li543-100 src]# pwd /usr/local/rvm/src drwxrwsr-x 7 root rvm 4096 Oct 1 21:19 . drwxrwsr-x 24 root rvm 4096 Oct 1 20:51 .. drwxr-xr-x 24 root rvm 8192 Oct 1 21:22 ruby-1.9.3-p194 drwxr-xr-x 7 501 games 4096 Apr 27 23:31 rubygems-1.8.24 drwxrwsr-x 18 root rvm 4096 Oct 1 20:51 rvm drwxrwsrwx 8 root rvm 4096 Oct 1 20:27 yaml-0.1.3 drwxr-xr-x 9 root rvm 4096 Oct 1 21:18 yaml-0.1.4 

EDIT # 2:
After abandoning another installation on a new CentOS 5.6 deployment, I explicitly made a fatal error during the installation process. Before doing rvm install 1.9.3 I had to run rvm install 1.8.7 . In addition, this time I deployed a 32-bit image of CentOS6.2.

Gem launch at 1.8.7

 [ root@li543-100 ~]# gem -v 1.8.24 

Now I run rvm install 1.9.2

 [ root@li543-100 ~]# rvm use 1.9.2 ruby-1.9.2-p320 is not installed. To install do: 'rvm install ruby-1.9.2-p320' [ root@li543-100 ~]# rvm install ruby-1.9.2-p320 #CUT OUT INSTALL SHELL PROMPTS ETC [ root@li543-100 ~]# rvm use 1.9.2-p320 Using /usr/local/rvm/gems/ruby-1.9.2-p320 [ root@li543-100 ~]# gem -v 1.8.24 

Switching to 1.9.3: Error returns

 [ root@li543-100 ~]# rvm use 1.9.3-p194 Using /usr/local/rvm/gems/ruby-1.9.3-p194 [ root@li543-100 ~]# gem -v /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. 1.8.24 

So it looks like rvm is using 1.9.3 (I think I'm using -p194, I have not tested it before) it causes some kind of communication problem in terms of where rvm trying to load libyaml. For now, I will use 1.9.2, since most of this material was slightly above my head. I am sure that I made a mistake in the absence of any dependency that 1.9.3 requires or does not adjust the configuration file accordingly. At least this is my guess, the first installation of the server, so a lot of this guessed.

+6
source share
3 answers

Remove all rvm, ruby, libyaml, etc.

Then install rvm and use rvm to install libyaml and rubies.

(Also note that Ruby can search for 32-bit libraries, so check if there is a version for 32 bits or if there is a separate lib folder for 64-bit libraries!)

PS Go check the hero to post your applications. Great for beginners as free, and 5 minutes to set up (15 minutes from installing rails to rails of an auto-generated web page on the hero!). And you do not need to change your settings, so deploying to your server will not be more difficult.

+1
source

I built libyaml separately and basically went through various permutations of the steps above with the same result. I ran irb and found that it did not find libyaml.so. In desparation, I copied / usr / local / lib / libyaml * (which I had previously built) to ~ / .rvm / rubies / ruby-1.9.3-p327 / lib.

This reassured the warning.

+3
source

After many tests below lock me

 # rvm pkg install libyaml # rvm reinstall all --force # ln -s /usr/local/rvm/usr/lib/libyaml.so /usr/local/rvm/lib/ # ln -s /usr/local/rvm/usr/lib/libyaml-0.so.2 /usr/local/rvm/lib/ # ln -s /usr/local/rvm/usr/lib/libyaml-0.so.2 /usr/local/rvm/rubies/ruby-1.9.3-p327/lib # ln -s /usr/local/rvm/usr/lib/libyaml.so /usr/local/rvm/rubies/ruby-1.9.3-p327/lib 

My environment

 # cat /etc/redhat-release CentOS release 5.8 (Final) # ruby -v ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux] # gem -v 1.8.24 # rvm -v rvm 1.16.20 (latest) by Wayne E. Seguin < wayneeseguin@gmail.com >, Michal Papis < mpapis@gmail.com > [https://rvm.io/] 
+2
source

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


All Articles