/usr/bin/ld: cannot find -lruby

Hello

     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) 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:
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…]

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 A. a écrit :

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

On Mon, Apr 5, 2010 at 11:39 PM, Venkat A.
[email protected] 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.

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

Venkat

Hemant K. wrote:

On Mon, Apr 5, 2010 at 11:39 PM, Venkat A.
[email protected] 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.

Hemant K. 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:

echo “/opt/ruby/lib” >/etc/ld.so.conf.d/ruby.conf
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
/opt/ruby/lib
to the end, then run ldconfig

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

Venkat

Brian C. wrote:

Hemant K. 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:

echo “/opt/ruby/lib” >/etc/ld.so.conf.d/ruby.conf
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
/opt/ruby/lib
to the end, then run ldconfig

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs