Reputation: 3856
I have compiled a library(GDAL) written in C/C++ with Ruby bindings.
After a ran make install
it was installed under
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/x86_64-darwin10.6.0/
There is a directory there called "gdal" with 4 files inside: gdal.so, gdalconst.so, ogr.so, osr.so
What I want now is to use these libraries in my project. The problem is that when I try to referense these files
require 'gdal/gdal'
I get
LoadError: no such file to load -- gdal/gdal from :29:in
require' from <internal:lib/rubygems/custom_require>:29:in
require' from (irb):1 from /Users/igor/.rvm/rubies/ruby-1.9.2-p136/bin/irb:16:in `'
When I run ruby -e 'puts $:'
I get following output:
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/x86_64-darwin10.6.0
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/vendor_ruby/1.9.1
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/vendor_ruby/1.9.1/x86_64-darwin10.6.0
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/vendor_ruby
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1
/Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0
Any ideas why it doesn't work for me?
Upvotes: 2
Views: 2074
Reputation: 3856
Thank you guys for your suggestions. I've finally figured out the problem. It seems like the fact that I was using rvm to manage ruby versions was causing the problem. As soon as I switched to system default(rvm use system
) everything worked out well.
Upvotes: 0
Reputation: 1122
It looks like you are not using a extconf.rb file to help you generate your makefile. You might want to read this tutorial and check Rice if you want to write a C++ extension. (Ruby is written in C and you need to expose a C API, Rice makes that easier).
Upvotes: 1
Reputation: 590
After make install
on OS X
you should have a .bundle
file in your path /Users/igor/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/x86_64-darwin10.6.0
.
If you want to use it then, you just have to require 'gdal'
and it should fine.
Upvotes: 1