Embedding Ruby Interpreter + RUBYGEMS

Discussion in 'Ruby' started by Christoph Müller, Jan 13, 2011.

  1. Hello everybody,

    I'm currently writing a c++ library, in which i need to embedded a ruby
    interpreter for calling the Ruby API.

    I've read already some interesting topics about this issue and already
    got a working setup for my interpreter.

    Unfortanetely i need also access to all gems provided by rubygems and
    that is currently failing everytime.

    e.g.

    # is always working
    rb_require("rubygems")

    # will results always result in the LoadError: "no such file to load -
    facets"
    rb_require("facets")

    it seems rubygems can't expand completely the loadpath with all
    necessary gems and the embedded ruby interpreter can't find the
    locations for all this libraries.

    In the net i already found a promising solution for that problem:
    http://subforge.org/blogs/show/1

    But this is currently not working on my machine and results in:
    "undefined reference to `Init_prelude' " (libruby1.8 is linked to my
    application)

    I guess, i should also mention, that i need to store all gems into
    another location and set up the environment variables GEM_HOME and
    GEM_PATH.

    require "facets" via irb is working.

    Does anyone know a fix workaround about this problem?

    I'm using Ruby 1.8.7 on Ubuntu 10.04 - 64Bit.

    Chris
     
    Christoph Müller, Jan 13, 2011
    #1
    1. Advertisements

  2. Christoph Müller

    Ryan Davis Guest

    That's the pure c require, not rubygem's extension of require.=
     
    Ryan Davis, Jan 13, 2011
    #2
    1. Advertisements

  3.  
    Jonas Pfenniger (zimbatm), Jan 13, 2011
    #3
  4. Oups, ... Now it works with this simple change.

    Thanks
     
    Christoph Müller, Jan 13, 2011
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.