Installing a ruby gem with a native extension

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?

On Apr 29, 7:56 pm, aj [email protected] wrote:

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

On Apr 30, 3:42 pm, aj [email protected] wrote:

How should I go about this?

- ruby

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 --debug -V”
provides you, the better.

On Apr 29, 9:43 pm, Luis L. [email protected] wrote:

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

Help us help you

Luis L.
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:

I am running it on a RHEL 3 machine.

On Apr 30, 2:56 pm, Luis L. [email protected] wrote:

I am new to ruby. I want to install a ruby gem which tries to build a

1.9.1
- :verbose => true

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 --debug -V”
provides you, the better.


Luis L.

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? "

On Apr 30, 3:34 pm, Mike D. [email protected] wrote:

How should I go about this?
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.

On 4/30/10, aj [email protected] wrote:

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.

On Fri, Apr 30, 2010 at 2:45 PM, aj [email protected]
wrote:

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.

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