Here is my setup:
Note: I put my custom libraries in ~/opt.
- Step 1: Download
Download xapian-core and xapian-binding from www.xapian.org to ~/opt/src. Untar the files.
- Step 3: Install xapian-core
$ cd ~/src/xapian-core directory.
$ ./configure –prefix=$HOME/opt
$ make
$ make install
- Step 4: Install xapian-bindings
$ mkdir ~/opt/my_ruby_modules
$ cd ~/src/xapian-bindings
$ ./configure –with-ruby
–prefix=$HOME/opt RUBY_LIB=$HOME/opt/my_ruby_modules RUBY_LIB_ARCH=$HOME/opt/my_ruby_modules
$ make$ make install
- Step 5: Configure your Rails site to use your modules
In config/environment.rb:
if RAILS_ENV == ‘production’
config.load_paths += [ ENV['HOME'] + ‘/opt/my_ruby_modules’ ]
end
Note: When you run your xapian rake tasks you’ll incorrectly get this message, “acts_as_xapian: No Ruby bindings for Xapian installed” but everything works fine.

5 Responses to “Installing xapian on Dreamhost for the rails acts_as_xapian plugin”
Matt January 18, 2009
Hi Kevin,
I am trying to get xapian and acts_as_xapian installed in my app. I can get it just fine locally, but not on my dreamhost server. I have been followed your instructions to a T multiple times but am still not getting it working. Everything compiles fine and I think all the required files get installed as there are no errors during the make and make install.
When I try to rebuild the index, is is squaking about not finding the _xapian.so file, but it is there!
[ps6736]$ ls /home/mconeybeare/opt/my_ruby_modules/_xapian.so
/home/mconeybeare/opt/my_ruby_modules/_xapian.so
I have tried changing permission on that file:
[ps6736]$ ls -la /home/mconeybeare/opt/my_ruby_modules/_xapian.so
-rwxr-xr-x 1 mconeybeare pg1243896 1753384 Jan 17 01:37 /home/mconeybeare/opt/my_ruby_modules/_xapian.so
I made sure that the path (/home/mconeybeare/opt/my_ruby_modules/) is included in my
[ps6736]$ echo $LD_LIBRARY_PATH
/home/mconeybeare/.packages/lib:/home/mconeybeare/run/lib:/home/mconeybeare/opt/lib:/home/mconeybeare/opt/my_ruby_modules:
and I have the step 5 code in environment.rb
Can you help me?
Here is the exact error message:
——————————–
[ps6736]$ rake xapian:rebuild_index models=”Sound” RAILS_ENV=production –trace
(in /home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227)
acts_as_xapian: No Ruby bindings for Xapian installed
** Invoke xapian:rebuild_index (first_time)
** Invoke environment (first_time)
** Execute environment
acts_as_xapian: No Ruby bindings for Xapian installed
** Execute xapian:rebuild_index
rake aborted!
/home/mconeybeare/opt/my_ruby_modules/_xapian.so: cannot open shared object file: No such file or directory – /home/mconeybeare/opt/my_ruby_modules/_xapian.so
/home/mconeybeare/opt/my_ruby_modules/_xapian.so
/home/mconeybeare/.packages/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:148:in `require’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:507:in `new_constants_in’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:148:in `require’
/home/mconeybeare/opt/my_ruby_modules/xapian.rb:40
/home/mconeybeare/.packages/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/home/mconeybeare/.packages/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:148:in `require’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:507:in `new_constants_in’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:148:in `require’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:254:in `require_or_load’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:413:in `load_missing_constant’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:77:in `const_missing’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:89:in `const_missing’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:425:in `load_missing_constant’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/rails/activesupport/lib/active_support/dependencies.rb:77:in `const_missing’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb:105:in `prepare_environment’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb:535:in `rebuild_index’
/home/mconeybeare/ambiance.coneybeare.net/apps/ambiance/releases/20090117082227/vendor/plugins/acts_as_xapian/tasks/xapian.rake:25
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:617:in `call’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:617:in `execute’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:612:in `each’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:612:in `execute’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain’
/home/mconeybeare/.packages/lib/ruby/1.8/monitor.rb:242:in `synchronize’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:564:in `invoke’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:1997:in `each’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:1970:in `run’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling’
/home/mconeybeare/.gems/gems/rake-0.8.3/lib/rake.rb:1967:in `run’
/home/mconeybeare/.gems/gems/rake-0.8.3/bin/rake:31
/home/mconeybeare/.gems/bin/rake:19:in `load’
/home/mconeybeare/.gems/bin/rake:19
Thanks,
|Matt
kevincolyar January 18, 2009
I don’t know why it’s looking for _xapian.so. My install doesnt have an underscore. Maybe try a symbolic link to the correct file?
|KrisBelucci June 2, 2009
Great post! Just wanted to let you know you have a new subscriber- me!
|Gordon Anderson May 11, 2010
hi Kevin
Thanks for the pointers – I found a couple of problems with later versions of Rails (2.3.5) and Xapain (1.0.20) which I’ve managed to resolve
1) In .bashrc
export RUBYLIB=”/home/tripodwww/my_ruby_modules/:$RUBYLIB”
This allows rake creation and updates for xapian indexes to work
2) In config/environment.rb
config.load_paths += %W( /home/tripodwww/my_ruby_modules )
This appears to be slightly different syntax from your example, but things in Rails world do move. It fixes path issues with passenger so that Xapian works for searching within a Rails app on Dreamhost
Cheers
Gordon
|Gordon Anderson June 7, 2010
hi Kevin
I eventually switched to the xapit rails plugin, I found it more intuitive than acts as xapian to get going, and more importantly facetting was straightforward. As an example see http://www.tripodtravel.co.nz/site/photos/search/thailand which is powered by xapit – I need to sanitize the number of different values of focal lengths and shutter speeds though (e.g. wide angle, normal, telephoto for focal length instead of the individual focal lengths)
Cheers
Gordon
|