yaml.h not found after installing libyaml

Posted on

Problem :

I have installed libyaml yet Ruby install can not find yaml.h. I do not have sudo permissions so everything must be done as a normal user.

wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar -xzf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=/users/$USER
make
make install

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz
tar -xzf ruby-1.9.3-p484.tar.gz
cd ruby-1.9.3-p484
./configure --prefix=/users/$USER
make

Contains :

configuring psych
yaml.h is missing. Please install libyaml.
Failed to configure psych. It will not be installed.

yaml.h does exists at ~/include/yaml.h How do I specify that the ~/include and ~/lib paths are included?

NB : also have the same problem with libffi which I have installed.

Operating system and shell:

$ cat /etc/redhat-release 
Red Hat Enterprise Linux WS release 4 (Nahant Update 9)
$ echo $shell
/bin/tcsh

Solution :

Try using the --with-opt-dir option when compiling ruby. In this case since you installed yaml into /users/$USER, then you would also include it in --with-opt-dir:

$ cd ruby-1.9.3-p484
$ ./configure --prefix=/users/$USER  --with-opt-dir=/users/$USER

If you had installed yaml in a separate directory like so:

$ cd yaml-0.1.4
$ ./configure --prefix=/users/$USER/yaml014

Then you would specify the yaml directory when compiling ruby:

$ ./configure --prefix=/users/$USER  --with-opt-dir=/users/$USER/yaml014

Leave a Reply

Your email address will not be published. Required fields are marked *