installing a ruby gem with a native extension

A

aj

I am new to ruby. I want to install a ruby gem which tries to build a
native extension. The gem in this case is nokogiri. If I do gem
install nokogiri, the native extension dynamically links against
libxml, libxslt libs. I want to statically link against those libs.
How should I go about this?
 
L

Luis Lavena

I am new to ruby. I want to install a ruby gem which tries to build a
native extension. The gem in this case is nokogiri. If I do gem
install nokogiri, the native extension dynamically links against
libxml, libxslt libs. I want to statically link against those libs.
How should I go about this?

Please provide information about your ruby installation and rubygems
version (usually "gem env" command is enough)

Also, if using Linux, which distribution is helpful too to determine
which commands would you require to execute.

Help us help you
 
A

aj

Please provide information about your ruby installation and rubygems
version (usually "gem env" command is enough)

Also, if using Linux, which distribution is helpful too to determine
which commands would you require to execute.

Help us help you
Thanks for the reply Luis.
The output of gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.9.1 (2009-12-07 patchlevel 376) [i686-linux]
- INSTALLATION DIRECTORY: /opt/lin32/ruby-1.9.1-p376/lib/ruby/gems/
1.9.1
- RUBY EXECUTABLE: /opt/lin32/ruby-1.9.1-p376/bin/ruby
- EXECUTABLE DIRECTORY: /opt/lin32/ruby-1.9.1-p376/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /opt/lin2/ruby-1.9.1-p376/lib/ruby/gems/1.9.1
- /home/john/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/

I am running it on a RHEL 3 machine.
 
L

Luis Lavena

Please provide information about your ruby installation and rubygems
version (usually "gem env" command is enough)
Also, if using Linux, which distribution is helpful too to determine
which commands would you require to execute.
Help us help you

Thanks for the reply Luis.
The output of gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.1
  - RUBY VERSION: 1.9.1 (2009-12-07 patchlevel 376) [i686-linux]
  - INSTALLATION DIRECTORY: /opt/lin32/ruby-1.9.1-p376/lib/ruby/gems/
1.9.1
  - RUBY EXECUTABLE: /opt/lin32/ruby-1.9.1-p376/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/lin32/ruby-1.9.1-p376/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /opt/lin2/ruby-1.9.1-p376/lib/ruby/gems/1.9.1
     - /home/john/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     -http://gems.rubyforge.org/

I am running it on a RHEL 3 machine.

Please look in RHEL documentation how to install GCC and build tools
required to compilation.

Also, you will need the development headers/packages of your Ruby and
the libraries that the gem you install will require.

If you tell us more about "what" gem are you trying to install and the
specific error message when doing "gem install <gemname> --debug -V"
provides you, the better.
 
M

Mike Dalessio

[Note: parts of this message were removed to make it a legal post.]

I am running it on a RHEL 3 machine.

Perhaps you're trying to solve the wrong problem?

If you install alternative (to the system-installed) libxml2 and libxslt
shared libraries, it's very easy to tell Nokogiri to use those libraries to
dynamically link -- see
http://nokogiri.org/tutorials/installing_nokogiri.html for details (and a
RHEL example).

IMHO that's easier than trying to hack the extconf.rb to link statically.
 
A

aj

Thanks for the reply Luis.
The output of gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.1
  - RUBY VERSION: 1.9.1 (2009-12-07 patchlevel 376) [i686-linux]
  - INSTALLATION DIRECTORY: /opt/lin32/ruby-1.9.1-p376/lib/ruby/gems/
1.9.1
  - RUBY EXECUTABLE: /opt/lin32/ruby-1.9.1-p376/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/lin32/ruby-1.9.1-p376/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /opt/lin2/ruby-1.9.1-p376/lib/ruby/gems/1.9.1
     - /home/john/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     -http://gems.rubyforge.org/
I am running it on a RHEL 3 machine.

Please look in RHEL documentation how to install GCC and build tools
required to compilation.

Also, you will need the development headers/packages of your Ruby and
the libraries that the gem you install will require.

If you tell us more about "what" gem are you trying to install and the
specific error message when doing "gem install <gemname> --debug -V"
provides you, the better.

Hi Luis,
I said that in my original post - "The gem in this case is nokogiri.
If I do gem install nokogiri, the native extension dynamically links
against libxml, libxslt libs. I want to statically link against those
libs. How should I go about this? "
 
A

aj

[Note:  parts of this message were removed to make it a legal post.]

I am running it on a RHEL 3 machine.

Perhaps you're trying to solve the wrong problem?

If you install alternative (to the system-installed) libxml2 and libxslt
shared libraries, it's very easy to tell Nokogiri to use those libraries to
dynamically link -- seehttp://nokogiri.org/tutorials/installing_nokogiri.htmlfor details (and a
RHEL example).

IMHO that's easier than trying to hack the extconf.rb to link statically.

Thanks for the reply Mike. I do want to link them statically.
So I do
$ gem fetch nokogiri
How to extract the gem file? gem unpack works only on installed gem.
 
C

Caleb Clausen

Thanks for the reply Mike. I do want to link them statically.
So I do
$ gem fetch nokogiri
How to extract the gem file? gem unpack works only on installed gem.

Gems are tar archives containing gzipped tar archives and some
(gzipped) metadata. So, you can use tar to extract the gem.

Why do you want to link statically? It's going to end up being a fair
bit of effort.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top