Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

c-ext under Rubinius #6

Closed
zhando opened this Issue · 9 comments

2 participants

@zhando

It compiles but doesn't load under Rubinius 1.1.0

If you add:

$libs = "-lreadline"

before the "create_makefile" line in the extconf.rb, it will compile and load w/ Rubinius. This seems to work just fine with MRI 1.8.6, 1.8.7, 1.9.1, 1.9.2 as well. That is, I can do some autocompletes. However, I get two test failures with 1.9.2.

4 tests fail under rubinius

Tried it with jruby-head but it falls short. That c-ext implementation is a little immature at this point. 2 test fail.

@cldwalker
Owner

I'll add $libs. I'm not getting any test failures under 1.9.2 so please post.

@zhando

I'm running under Ubuntu Lucid 64-bit..

~/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2$ rake
(in /home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2)
bacon -q -Ilib -I. test/_test.rb
.......F...................................................FF............................................................................................................................................................................
Bacon::Error: "Bond Error: Failed during completion action with '

: syntax error, unexpected '}', expecting ']''.".=~(/Bond Error: Failed.action.*(eval)/) failed
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/agent_test.rb:28:in block in complete_error': #call - for completion action failing with Rc.eval and debug completes error
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/agent_test.rb:64:in
block (3 levels) in '
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:20:in call'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:20:in
block in it'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:17:in it'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/agent_test.rb:62:in
block (2 levels) in '
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bacon-bits-0.0.1/lib/bacon/bits.rb:18:in describe'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/agent_test.rb:4:in
block in '
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/agent_test.rb:3:in `'

Bacon::Error: ["Bond Error: Failed during completion action with 'can't convert Symbol into String'.", "Completion Info: Matches completion with condition /(([A-Z][^. \(])::([^: .]))$/."].==(["Foo::Bar::Baz"]) failed
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/completion_test.rb:29:in block (2 levels) in <top (required)>': Completion - completes nested classes greater than 2 levels
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:20:in
call'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:20:in block in it'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:17:in
it'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/completion_test.rb:27:in block in <top (required)>'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/completion_test.rb:3:in
'

Bacon::Error: ["Bond Error: Failed during completion action with 'can't convert Symbol into String'.", "Completion Info: Matches completion with condition /(([A-Z][^. \(])::([^: .]))$/."].==(["Bond::Search"]) failed
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/completion_test.rb:33:in block (2 levels) in <top (required)>': Completion - completes nested classes anywhere
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:20:in
call'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:20:in block in it'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:17:in
it'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/completion_test.rb:32:in block in <top (required)>'
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/test/completion_test.rb:3:in
'

233 tests, 539 assertions, 3 failures, 0 errors
rake aborted!
Command failed with status (1): [bacon -q -Ilib -I. test/*_test.rb...]
/home/zhando/.rvm/gems/ruby-1.9.2-p0/gems/bond-0.2.2/Rakefile:32:in `block in '
(See full trace by running task with --trace)

@cldwalker
Owner

I've fixed the rubinius and 1.9.2 tests.

However, I had no problem building and using bond's extension under rubinius 1.1.0 and mac osx. If you're using a nonstandard directory for readline have you tried gem install bond -- --with-readline-lib=/path/to/lib --with-readline-include=/path/to/include? Do you know what setting $libs does to the c extension? Can't find any info about that variable.

@zhando

Interesting.. Well I'm using Linux 64-bit. So whatever directory my Linux distro (Ubuntu/Debian) is using is what I'm using.

Whatever is assigned to $libs seems to be added to the LIBS assignment in the generated Makefile.

I just noticed that in another c-ext (careo-tokyocabinet) and tried it. Monkey see monkey do...

@zhando

Ok I think better code MIGHT be:

$libs = "#{$libs} -lreadline"

Haven't had a chance to test. Again just by reading the extconf.rb in careo-tokyocabinet.

And $libs comes from mkmf.rb..

@cldwalker
Owner

A more elegant way to do this may be to use mkmf's have_library. I also have to make sure in doing this I don't force readline as a dependency and allow bond to install on default osx which comes with editline. I'll ping you when I have something for you to try.

@cldwalker
Owner

Could you try the rubinius branch to see if it works?:
$ git clone git://github.com/cldwalker/bond.git
$ git checkout -t origin/rubinius
$ rake install

@zhando

Yes. This works just fine under rubinius. Even tried it under a couple of 1.8 MRI's. Works there too.

The extconf.rb code can't be more straightforward. Looks like a win.

@cldwalker
Owner

Released new version!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.