Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#323 closed defect (fixed)

Can not build xapian-bindings for ruby 1.9

Reported by: cheba Owned by: olly
Priority: normal Milestone: 1.0.11
Component: Xapian-bindings Version: 1.0.10
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by olly)

First, ruby 1.9 has special key in rbconfig for headers dir. It's called rubyhdrdir.

Second, for some reason config.h can not be found.

Attachments (5)

xapian-bindings-1.0.10-ruby-1.9-hdrdir-2.patch (503 bytes) - added by cheba 11 years ago.
Ruby 1.9 knows where its header located
xapian-bindings-1.0.10-configure.log (6.4 KB) - added by cheba 11 years ago.
configure
xapian-bindings-1.0.10-make.log (9.0 KB) - added by cheba 11 years ago.
make
xapian-bindings-1.0.10-make2.log (5.1 KB) - added by cheba 11 years ago.
make INCLUDES=-Iruby -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"] + "/" + Config::CONFIG["arch"]'
Makefile (3.9 KB) - added by cheba 11 years ago.
Makefile for extension generated bu Ruby 1.9.1 RC1 itself (using mkmf facilities)

Download all attachments as: .zip

Change History (21)

Changed 11 years ago by cheba

Ruby 1.9 knows where its header located

comment:1 Changed 11 years ago by olly

  • Component changed from Build system to Xapian-bindings
  • Milestone set to 1.0.11
  • Status changed from new to assigned
  • Version set to 1.0.10

I assume from the patch filename this was with 1.0.10 - if not please correct the version I've set.

I went for combining the two into a single command since otherwise I get "nil" for Ruby 1.8 (and this also avoids the overhead of running Ruby a second time for Ruby < 1.9):

[RUBY_INC=`$RUBY -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"] || Config::CONFIG["archdir"]'`]

Also, interestingly ruby1.9 on Debian etch doesn't have rubyhdrdir. I guess it is probably a snapshot and this was added later on.

I've no idea about your config.h issue. You're going to give some details. Tell us what you did and what the result was (and what you expected to happen instead if that's not completely obvious).

comment:2 Changed 11 years ago by cheba

Yes, this is for xapian-bindings 1.0.10.

I use Ruby 1.9.1 RC1. Distro is Gentoo. Ruby has a few patches applied but those are for ruby gems. I can provide you build options for ruby if you need. Please, tell what exactly can be useful.

comment:3 Changed 11 years ago by olly

  • Description modified (diff)

The commands you typed to build and their output. Probably just for xapian-bindings to start with. If there's a lot of output, it's probably better to include it all (log it to a file and attach it to this ticket) rather than risk trimming out something relevant.

comment:4 Changed 11 years ago by cheba

xapian-bindings 1.0.10 Applied your patch for rubyhdrdir.

./configure --prefix=/usr --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --without-python --without-php --without-tcl --without-csharp --without-java --with-ruby --build=i686-pc-linux-gnu

Changed 11 years ago by cheba

configure

Changed 11 years ago by cheba

make

comment:5 Changed 11 years ago by olly

It looks like we also now need a -I for:

Config::CONFIG["rubyhdrdir"] + "/" + Config::CONFIG["arch"]

Perhaps there's a cleaner way to get the required list of -I options? Just adding them like this feels a bit ad-hoc, but I'm not a Ruby expert.

Anyway, for now try rerunning make like so continue as if we had done this so we can see if there are any further issues:

make INCLUDES=-I`ruby -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"] + "/" + Config::CONFIG["arch"]'`

comment:6 Changed 11 years ago by cheba

I'm getting error:

xapian_wrap.cc:2966:20: error: rubyio.h: No such file or directory

My Ruby installation doesn't have it. Instead it has ruby/io.h.

comment:7 Changed 11 years ago by olly

Hmm, there's an impressive lack of consistency between distros here - Ubuntu intrepid has a compatibility header for rubyio.h which just includes ruby/io.h:

-rw-r--r-- 1 root root 3274 2008-01-07 04:49 /usr/include/ruby-1.9.0/ruby/io.h
-rw-r--r-- 1 root root   21 2007-06-10 15:06 /usr/include/ruby-1.9.0/rubyio.h

This header inclusion comes from SWIG and there's machinery in more recent SWIG versions to handle this it seems.

For now, let's try a simpler workaround - from the xapian-bindings-1.0.10 directory:

echo '#include "ruby/io.h"' > ruby/rubyio.h
make INCLUDES=-I`ruby -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"] + "/" + Config::CONFIG["arch"]'`

Changed 11 years ago by cheba

make INCLUDES=-Iruby -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"] + "/" + Config::CONFIG["arch"]'

comment:8 Changed 11 years ago by olly

OK, the first slew are due to a new, and arguably broken, optimisation in ruby.h. Not totally sure what to do about those. I guess just #undef rb_intern and then GCC uses the same code as other compilers do, and as Ruby 1.8 had.

The last six are easier - I'll commit a fix for those in a moment.

Changed 11 years ago by cheba

Makefile for extension generated bu Ruby 1.9.1 RC1 itself (using mkmf facilities)

comment:9 Changed 11 years ago by cheba

The attached Makefile has some bits that you can use to build bindings against ruby 1.9.

comment:10 Changed 11 years ago by olly

Fixes committed for the remaining issues to SVN trunk r11938. Needs backporting before 1.0.11.

comment:11 Changed 11 years ago by olly

r11939 should fix the rubyio.h issue, which I'd missed, and also fixes a bug in r11938.

comment:12 Changed 11 years ago by olly

With Ruby 1.8, make check gives me:

Loaded suite ./smoketest
Started
................
Finished in 0.096853 seconds.

16 tests, 38 assertions, 0 failures, 0 errors
PASS: smoketest.rb
=============
1 test passed
=============

With Ruby 1.9, make check gives me:

Loaded suite ./smoketest
Started
/usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:94:in `sub!': can't modify frozen string (RuntimeError)
	from /usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:94:in `test_started'
	from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in `call'
	from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in `block in notify_listeners'
	from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in `each'
	from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in `notify_listeners'
	from /usr/lib/ruby/1.9.0/test/unit/ui/testrunnermediator.rb:47:in `block in run_suite'
	from /usr/lib/ruby/1.9.0/test/unit/testcase.rb:72:in `run'
	from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:34:in `block in run'
	from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `each'
	from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `run'
	from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:34:in `block in run'
	from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `each'
	from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `run'
	from /usr/lib/ruby/1.9.0/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
	from /usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
	from /usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:41:in `start'
	from /usr/lib/ruby/1.9.0/test/unit/ui/testrunnerutilities.rb:29:in `run'
	from /usr/lib/ruby/1.9.0/test/unit/autorunner.rb:216:in `run'
	from /usr/lib/ruby/1.9.0/test/unit/autorunner.rb:12:in `run'
	from /usr/lib/ruby/1.9.0/test/unit.rb:278:in `block in <top (required)>'
FAIL: smoketest.rb
=======================================
1 of 1 test failed
Please report to http://xapian.org/bugs
=======================================

I'm guessing some change in 1.9 breaks something in smoketest.rb but the backtrace doesn't help me see what. Any ideas?

comment:13 Changed 11 years ago by olly

  • Milestone changed from 1.0.11 to 1.1.1

Googling for the error message, it seems this may be down to ruby 1.9.0 being a development release:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f8714996e5653790/90535a304f4728f7

It's quite possible that the issue is just the test suite and that the bindings work, but even if not, failing to work with a development version of Ruby isn't such a big deal as failing to work with a stable release, so this doesn't need to be fixed for 1.0.x currently, nor block the 1.1.0 development release.

Hence moving to milestone:1.1.1

It would be nice to find out if the problem has been fixed, and if not to report it to the Ruby developers (to make sure this doesn't turn into a failure to work with the next stable release) but I don't have the time to do so right now, so that will probably have to wait until someone with more Ruby skills steps in to help.

comment:14 Changed 11 years ago by olly

Sounds like this is the bug in Ruby 1.9.0's "test/unit" and may well be fixed in Ruby 1.9.1:

http://redmine.ruby-lang.org/issues/show/771

If you're easily able to test with 1.9.1, please do report back.

comment:15 Changed 10 years ago by olly

  • Resolution set to fixed
  • Status changed from assigned to closed

Tested with Ruby 1.9.1, where "make check" passes.

comment:16 Changed 10 years ago by olly

  • Milestone changed from 1.1.1 to 1.0.11

This was backported to branches/1.0 in r12114 and released on 1.0.11.

Updated the xapian-bindings README to note that Ruby 1.9 is supported and 1.9.1 passes "make check" for 1.0.13 in r12742.

Note: See TracTickets for help on using tickets.