Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

for compiled libraries, like libyaml, where does Ruby (or the RVM) search within the filesystem in order to load or resolve them?

Operating System: CentOS 6.2 x86_64
I apologize for indentation being wonky. This is my first SO post and I am new to setting up servers. I am learning though and will detail the steps I have gone through trying to solve this as well as where I looked for help. I'm an aspiring young web developer and I work on a server that someone else had configured, so this whole experience is new to me.

I've be preparing a linode I recently purchased to run a rails app. I followed the initial installation guide provided here http://blog.blenderbox.com/2011/01/07/installing-rvm-ruby-rails-passenger-nginx-on-centos/, as well as changing the step:
sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )
To reflect the changes advised in this SO thread RVM system-wide install script url broken -- what is replacement?

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

I stopped at the ngix installation because I am using Apache2. I also made sure to run rvm requirements and install the necessary packages prior to the installation of rails. This is where libyaml was tasked for install and the first error occurred with me trying to install it. However, yum reported that it did not exist. The initial install of RVM and Gems appeared to work, however I encountered an issue with Gems missing '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 through Yum but received 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 this same problem.

After doing some research I found this blog post by CollectiveIdea that detailed the same problem and offered a solution. Blog Post by Collective Idea I followed the instructions and performed the install without any make or configure problems. I then performed the ruby reinstall provided. I was still presented with the same warning and searched further into SO for similar issues. As detailed by responses to this question regarding the same problem, how to solve "ruby installation is missing psych" 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's required to reinstall all rubies:

It was advised to reinstall everything through RVM and I followed these instructions as well.

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 this the warning is still present. I have verified the ruby installation with ruby -v and it is in fact installed. The libyaml files were installed, they reside 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 may have been installed into the wrong directory or that rvm was not looking in the proper directory for them. I ran a which on ruby and thought because ruby was in the /rvm dir that could be the issue:

[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/ 

This did not help. So I am on the fence with where I went wrong or what I am not looking for.
1: Did I make an installation mistake by placing the files in the wrong dir?
2: Is ruby looking for the libyaml files in a different directory?
3: When I followed the blog posts did I fail to add some system specific feature to the installs?

I have redeployed CentOS on my linode 4 times, hoping that this was an issue with me not following the scripts appropriately, I am on the 5th deploy with the same issue popping up. I am currently searching SO for number 2 and hopefully my post isn't inappropriate as this is clearly solved somewhere else. I would appreciate any help you could provide.

EDIT:

So after redeploying the CentOS6.2 OS I ran altered setup like so:

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 too still encountered the 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 the previous commands to get libyaml from RVM and to then reinstall all rubies does not seem to fix the issue for me. When performing the rvm reinstall all --force, will the installation of the previous libyaml package be removed, overwritten or replaced? It appears 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 failing another install on a new CentOS 5.6 redeploy I was clearly making a fatal flaw somewhere in the installation process. Prior to performing rvm install 1.9.3, I had to run rvm install 1.8.7. Also, I deployed a 32bit CentOS6.2 image this time instead

Running gem on 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 telling rvm to use 1.9.3 (mind you I am using -p194, i have not tested the ones prior) causes some sort of communication problem in terms of where rvm attempts to load libyaml. For now I will be using 1.9.2 as most of this stuff has been a little over my head. I'm sure I have made a mistake in lacking some sort of dependency that 1.9.3 requires or not adjusting a config file appropriately. At least this is my assumption, first server setup so much of this has been guessing.

like image 577
Austen Tomek Avatar asked Oct 01 '12 18:10

Austen Tomek


1 Answers

I had built libyaml separately and basically went through various permutations of the steps above with the same result. I ran irb and found that it wasn't finding 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 quieted the warning.

like image 76
Dave Hildebrandt Avatar answered Oct 22 '22 15:10

Dave Hildebrandt