# /usr/bin/ld: cannot find -lruby

**URL:** <https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019>\
**Category:** ruby-talk\
**Created:** [5 April 2010 10:46 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019 "2010-04-05T10:46:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Venkat\_Akkineni](https://avatars.discourse-cdn.com/v4/letter/v/958977/32.png) [@Venkat\_Akkineni](https://rubytalk.org/u/Venkat_Akkineni)\
**Post date:** [5 April 2010 10:46 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/1 "2010-04-05T10:46:23Z")

</div>

Hello

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I got the following error when I tried to install ruby-opengl  
gem. I attached the entire command line output. The error seems to be  
"/usr/bin/ld: cannot find -lruby". I have a locally compiled ruby  
1.9.1p243 installed. After doing some research I found a blog post  
([http://ubuntuforums.org/showthread.php?t=204908](http://ubuntuforums.org/showthread.php?t=204908)) that describes similar  
problem for perl. That post suggests installation of libperl-dev!!! I am  
unable to translate this solution to my problem. Any help is  
appreciated.

Thanks  
Venkat

ERROR: Error installing ruby-opengl:  
&nbsp;&nbsp;ERROR: Failed to build gem native extension.

/usr/local/bin/ruby -rubygems  
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake  
RUBYARCHDIR=/usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/lib  
RUBYLIBDIR=/usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/lib  
/usr/local/bin/ruby mkrf\_conf.rb  
(in /usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1)  
rake  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-2.0.c  
(in /usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/ext/gl)  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.0-1.1.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-enums.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-ati.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.5.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-gremedy.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-arb.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-error.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.2.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-3dfx.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-nv.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-2.1.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-ext.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.3.c  
gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
-I/usr/local/include/ruby-1.9.1  
-I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/lib/ruby/1.9.1/i686-linux  
-I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.4.c  
gcc -shared -L/usr/local/lib -o [gl.so](http://gl.so) gl-2.0.o gl.o gl-1.0-1.1.o  
gl-enums.o gl-ext-ati.o gl-1.5.o gl-ext-gremedy.o gl-ext-arb.o  
gl-error.o gl-1.2.o gl-ext-3dfx.o gl-ext-nv.o gl-2.1.o gl-ext-ext.o  
gl-1.3.o gl-1.4.o -lpthread -lrt -ldl -lcrypt -lm -lGL -Wl,-R  
-Wl,/usr/local/lib -L/usr/local/lib -lruby  
/usr/bin/ld: cannot find -lruby  
collect2: ld returned 1 exit status  
rake aborted!  
Command failed with status (1): [gcc -shared -L/usr/local/lib -o [gl.so](http://gl.so)  
gl...]  
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/ext/gl/Rakefile:34:in  
`block in \<top (required)\>'  
(See full trace by running task with --trace)  
rake aborted!  
Command failed with status (1): [rake...]

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![AMILIN\_Aurelien](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@AMILIN\_Aurelien](https://rubytalk.org/u/AMILIN_Aurelien)\
**Post date:** [5 April 2010 11:06 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/2 "2010-04-05T11:06:20Z")

</div>

The problem is that ruby-opengl need to compile some C code to make the  
bindings between ruby and opengl.  
And for that you need ruby source code.

The easy way is to install with your package manager (apt-get, yum ...)  
the source code of ruby the package name should be ruby-dev, ruby-devel  
... something like that (depending on your linux distribution)  
The hard way is to put the source code you've download into the right  
directory but I don't know how

Then you should be able to install ruby-opengl

> **···**
>
> Le 05/04/2010 12:46, Venkat Akkineni a écrit :
> 
> > Hello
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I got the following error when I tried to install ruby-opengl  
> > gem. I attached the entire command line output. The error seems to be  
> > "/usr/bin/ld: cannot find -lruby". I have a locally compiled ruby  
> > 1.9.1p243 installed. After doing some research I found a blog post  
> > ([Error "/usr/bin/ld: cannot find -lperl"](http://ubuntuforums.org/showthread.php?t=204908%5C)) that describes similar  
> > problem for perl. That post suggests installation of libperl-dev!!! I am  
> > unable to translate this solution to my problem. Any help is  
> > appreciated.
> > 
> > Thanks  
> > Venkat
> > 
> > ERROR: Error installing ruby-opengl:  
> > &nbsp;&nbsp;ERROR: Failed to build gem native extension.
> > 
> > /usr/local/bin/ruby -rubygems  
> > /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake  
> > RUBYARCHDIR=/usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/lib  
> > RUBYLIBDIR=/usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/lib  
> > /usr/local/bin/ruby mkrf\_conf.rb  
> > (in /usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1)  
> > rake  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-2.0.c  
> > (in /usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/ext/gl)  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.0-1.1.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-enums.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-ati.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.5.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-gremedy.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-arb.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-error.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.2.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-3dfx.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-nv.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-2.1.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-ext-ext.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.3.c  
> > gcc -fPIC -O2 -g -Wall -Wno-parentheses -Wall -DRUBY\_VERSION=191  
> > -I/usr/local/include/ruby-1.9.1  
> > -I/usr/local/include/ruby-1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/1.9.1/i686-linux  
> > -I/usr/local/lib/ruby/site\_ruby/1.9.1 -I. -c gl-1.4.c  
> > gcc -shared -L/usr/local/lib -o gl.so gl-2.0.o gl.o gl-1.0-1.1.o  
> > gl-enums.o gl-ext-ati.o gl-1.5.o gl-ext-gremedy.o gl-ext-arb.o  
> > gl-error.o gl-1.2.o gl-ext-3dfx.o gl-ext-nv.o gl-2.1.o gl-ext-ext.o  
> > gl-1.3.o gl-1.4.o -lpthread -lrt -ldl -lcrypt -lm -lGL -Wl,-R  
> > -Wl,/usr/local/lib -L/usr/local/lib -lruby  
> > /usr/bin/ld: cannot find -lruby  
> > collect2: ld returned 1 exit status  
> > rake aborted!  
> > Command failed with status (1): [gcc -shared -L/usr/local/lib -o gl.so  
> > gl...]  
> > /usr/local/lib/ruby/gems/1.9.1/gems/ruby-opengl-0.60.1/ext/gl/Rakefile:34:in  
> > `block in \<top (required)\>'  
> > (See full trace by running task with --trace)  
> > rake aborted!  
> > Command failed with status (1): [rake...]

---

<div class="post-metadata">

**Author:** ![Venkat\_Akkineni](https://avatars.discourse-cdn.com/v4/letter/v/958977/32.png) [@Venkat\_Akkineni](https://rubytalk.org/u/Venkat_Akkineni)\
**Post date:** [5 April 2010 18:09 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/3 "2010-04-05T18:09:09Z")

</div>

Thanks for your reply. I want to configure my sources directory. Does  
anybody know how to do this?

> The hard way is to put the source code you've download into the right  
> directory but I don't know how

Thanks  
Venkat

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://avatars.discourse-cdn.com/v4/letter/h/46a35a/32.png) [@Hemant\_Kumar](https://rubytalk.org/u/Hemant_Kumar)\
**Post date:** [5 April 2010 20:13 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/4 "2010-04-05T20:13:07Z")

</div>

You should configure ruby with "--enable-shared" option and then you  
can just put

export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/opt/ruby/lib:.

this should fix you up, in no time.

> **···**
>
> On Mon, Apr 5, 2010 at 11:39 PM, Venkat Akkineni \<venkatram.akkineni@gmail.com\> wrote:
> 
> > Thanks for your reply. I want to configure my sources directory. Does  
> > anybody know how to do this?
> > 
> > > The hard way is to put the source code you've download into the right  
> > > directory but I don't know how

---

<div class="post-metadata">

**Author:** ![Venkat\_Akkineni](https://avatars.discourse-cdn.com/v4/letter/v/958977/32.png) [@Venkat\_Akkineni](https://rubytalk.org/u/Venkat_Akkineni)\
**Post date:** [5 April 2010 22:44 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/5 "2010-04-05T22:44:20Z")

</div>

Thanks for that tip hemant. It worked like a charm.

Venkat

Hemant Kumar wrote:

> **···**
>
> > On Mon, Apr 5, 2010 at 11:39 PM, Venkat Akkineni \> \<venkatram.akkineni@gmail.com\> wrote:
> > 
> > > Thanks for your reply. I want to configure my sources directory. Does  
> > > anybody know how to do this?
> > > 
> > > > The hard way is to put the source code you've download into the right  
> > > > directory but I don't know how
> > 
> > You should configure ruby with "--enable-shared" option and then you  
> > can just put
> > 
> > export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/opt/ruby/lib:.
> > 
> > this should fix you up, in no time.
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://rubytalk.org/u/Brian_Candler)\
**Post date:** [6 April 2010 13:42 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/6 "2010-04-06T13:42:17Z")

</div>

Hemant Kumar wrote:

> You should configure ruby with "--enable-shared" option and then you  
> can just put
> 
> export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/opt/ruby/lib:.
> 
> this should fix you up, in no time.

LD\_LIBRARY\_PATH is a rather fragile frig. It will fail whenever this  
environment variable is not set.

In any modern Linux distro, you should be able to do this:

&nbsp;&nbsp;echo "/opt/ruby/lib" \>/etc/ld.so.conf.d/ruby.conf  
&nbsp;&nbsp;ldconfig

which will configure the loader permanently to search for libraries in  
/opt/ruby/lib, and does not depend on environment variables.

If you don't have an /etc/ld.so.conf.d/ directory, then edit  
/etc/ld.so.conf, add the line  
&nbsp;&nbsp;/opt/ruby/lib  
to the end, then run ldconfig

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Venkat\_Akkineni](https://avatars.discourse-cdn.com/v4/letter/v/958977/32.png) [@Venkat\_Akkineni](https://rubytalk.org/u/Venkat_Akkineni)\
**Post date:** [6 April 2010 17:10 UTC](https://rubytalk.org/t/usr-bin-ld-cannot-find-lruby/58019/7 "2010-04-06T17:10:45Z")

</div>

Thanks for the tip Brian. Now I know one more linux tool i.e ldconfig.

Venkat

Brian Candler wrote:

> **···**
>
> > Hemant Kumar wrote:
> > 
> > > You should configure ruby with "--enable-shared" option and then you  
> > > can just put
> > > 
> > > export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/opt/ruby/lib:.
> > > 
> > > this should fix you up, in no time.
> > 
> > LD\_LIBRARY\_PATH is a rather fragile frig. It will fail whenever this  
> > environment variable is not set.
> > 
> > In any modern Linux distro, you should be able to do this:
> > 
> > &nbsp;&nbsp;echo "/opt/ruby/lib" \>/etc/ld.so.conf.d/ruby.conf  
> > &nbsp;&nbsp;ldconfig
> > 
> > which will configure the loader permanently to search for libraries in  
> > /opt/ruby/lib, and does not depend on environment variables.
> > 
> > If you don't have an /etc/ld.so.conf.d/ directory, then edit  
> > /etc/ld.so.conf, add the line  
> > &nbsp;&nbsp;/opt/ruby/lib  
> > to the end, then run ldconfig
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
