problems with gem installation with rvm and OS X Lion

Showing 1-17 of 17 messages
problems with gem installation with rvm and OS X Lion David Lowenfels 6/18/12 2:31 PM
Hi, 
  I'm trying to get picky to install. I'm using RVM on OS X Lion.

bundle install reports "Your bundle is complete!" with no errors, but when I require 'picky'
I get the compilation from picky-4.4.1/lib/picky/ext/maybe_compile.rb
the compiled bundle is there and I even did a make install

but still 'ruby19/performant' is not being loaded, as evidenced below:

(bash)[dfl@cosminyah gearroom]$ irb
ruby-1.9.3-p194 :001 > require 'picky'
Compiling with Ruby 1.9
checking for ruby.h... yes
creating Makefile

.... never ends, have to ctrl-C out of it

Any hints on how to get this to work?
I'd like to use picky but if I can't install it I'll have to go back to solr or sphinx :(

Thanks,
David

Re: problems with gem installation with rvm and OS X Lion David Lowenfels 6/18/12 2:33 PM
 PS I'm using ruby-1.9.3-p194
Re: problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/18/12 4:58 PM
Hi David,

Thanks for the feedback. Let's find out how to make this work together.

That sounds curious. So the line require_relative 'ruby19/performant' in maybe_compile.rb raises a LoadError, with the compiled bundle being there?
So (sorry if this is a stupid question) the "performant.bundle" file is there, in a ruby19 directory which is next to the maybe_compile.rb file?
Do you have multiple Pickies installed, and you might not look at the one that is actually used?

We'll figure this out :) Cheers,
   Florian
Re: [picky:55] Re: problems with gem installation with rvm and OS X Lion David Lowenfels 6/18/12 5:01 PM
Hi Florian, thanks for your quick response.

On Jun 18, 2012, at 4:58 PM, Picky / Florian Hanke wrote:

> Hi David,
>
> Thanks for the feedback. Let's find out how to make this work together.
>
> That sounds curious. So the line require_relative 'ruby19/performant' in maybe_compile.rb raises a LoadError, with the compiled bundle being there?
> So (sorry if this is a stupid question) the "performant.bundle" file is there, in a ruby19 directory which is next to the maybe_compile.rb file?
yes, that's correct

> Do you have multiple Pickies installed, and you might not look at the one that is actually used?
not that I'm aware of.
I tried to install it in my global rvm as well as my gemset, but had the same issues

Meanwhile, I'm discovering that postgres full text search might be good enough for now…
but I would like to play around with Picky anyways, it seems like a cool project that I want to support.

-D
Re: [picky:55] Re: problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/18/12 6:06 PM
Hi David,

My pleasure.

Glad to hear Postgres fulltext is already working well. Picky fills a completely different spot in that it is less about full text, and more about semantic searching.
Also, happy to hear you want to support the project :) The best support currently comes from blog posts by happy customers (of which there are many, but none are avid blog writers, sadly).

What happens if you create a new Ruby file with "require_relative 'ruby19/performant'" in it, with the compiled bundle in a ruby19 dir next to it, and run the Ruby file – does it load or do you get a load error?
(Sorry this is so basic, but I think it's good to verify from the ground up – I want to be really sure that this works in the most basic environment. And if not, why not.)

Cheers,
   Florian
Re: [picky:57] problems with gem installation with rvm and OS X Lion David Lowenfels 6/20/12 11:09 PM
looks like maybe the bundle isn't being properly compiled for my system?

(bash)[dfl@cosminyah ext]$ ls ruby19/
Makefile           extconf.rb         mkmf.log           performant.bundle* performant.c       performant.o
(bash)[dfl@cosminyah ext]$ cat > foo.rb
require 'ruby19/performant'
^C
(bash)[dfl@cosminyah ext]$ ruby foo.rb
/Users/dfl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- ruby19/performant (LoadError)
        from /Users/dfl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from foo.rb:1:in `<main>'
Re: [picky:58] problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/20/12 11:22 PM
What does the asterisk in the filename mean in this case?
Re: [picky:60] problems with gem installation with rvm and OS X Lion David Lowenfels 6/20/12 11:24 PM
it means it's executable
Re: [picky:60] problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/20/12 11:27 PM
Ah, thanks. I just noticed something: Use require_relative, not require, please, since that is what I use in Picky. (Or add the current dir to the load path, also an option, with require)
Re: [picky:62] problems with gem installation with rvm and OS X Lion David Lowenfels 6/20/12 11:30 PM
(bash)[dfl@cosminyah ext]$ cat > foo.rb
require_relative 'ruby19/performant'
^C
(bash)[dfl@cosminyah ext]$ ruby foo.rb
foo.rb:1:in `require_relative': dlopen(/Users/dfl/.rvm/gems/ruby-1.9.3-p194@gearroom/gems/picky-4.4.1/lib/picky/ext/ruby19/performant.bundle, 9): Symbol not found: _memory_efficient_intersect (LoadError)
  Referenced from: /Users/dfl/.rvm/gems/ruby-1.9.3-p194@gearroom/gems/picky-4.4.1/lib/picky/ext/ruby19/performant.bundle
  Expected in: flat namespace
 in /Users/dfl/.rvm/gems/ruby-1.9.3-p194@gearroom/gems/picky-4.4.1/lib/picky/ext/ruby19/performant.bundle - /Users/dfl/.rvm/gems/ruby-1.9.3-p194@gearroom/gems/picky-4.4.1/lib/picky/ext/ruby19/performant.bundle
        from foo.rb:1:in `<main>'

Re: [picky:62] problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/21/12 12:01 AM
What if you go into the gem directory, from there into lib/picky/ext/ruby19, then call ruby extconf.rb, then simply make. What output do you get? Thanks!
Re: [picky:64] problems with gem installation with rvm and OS X Lion David Lowenfels 6/21/12 12:03 AM
(bash)[dfl@cosminyah ruby19]$ ruby extconf.rb
Compiling with Ruby 1.9
checking for ruby.h... yes
creating Makefile
(bash)[dfl@cosminyah ruby19]$ make
linking shared-object performant.bundle
(bash)[dfl@cosminyah ruby19]$ make clean
(bash)[dfl@cosminyah ruby19]$ make
compiling performant.c
performant.c:58:22: warning: incompatible integer to pointer conversion assigning to 'struct RArray *' from 'VALUE' (aka 'unsigned long')
  rb_array_of_arrays = rb_block_call(unsorted_array_of_arrays, rb_intern("sort_by!"), 0, 0, rb_ary_length, 0);
                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
linking shared-object performant.bundle
Re: [picky:64] problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/21/12 12:45 AM
It's baffling. This looks perfect (yes, the warning's cause needs to be eliminated, but it should work already). Any ideas? Does Ruby require not recognize .bundle Files anymore?
Re: [picky:66] problems with gem installation with rvm and OS X Lion David Lowenfels 6/21/12 3:56 PM
turns out this is related to LLVM gcc (aka clang) with the latest Mac Developer tools.
ruby-1.9.3 gets compiled with this.

Looks like I fixed the problem by changing the makefile to point to gcc-4.2 (which I installed with homebrew: brew install apple-gcc42)

CC = gcc-4.2
CXX = gcc-4.2

ruby-1.9.3-p194 :001 > require 'picky'
 => true
Re: [picky:66] problems with gem installation with rvm and OS X Lion David Lowenfels 6/21/12 4:10 PM
looks like my plain gcc (rather than homebrew version) also works (gem gets loaded with no errors)

(bash)[dfl@cosminyah ext]$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)

if you added this to extconf.rb:
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']

then I could do this:
CC=gcc gem install picky
c.f. http://stackoverflow.com/questions/4554837/how-to-specify-compiler-for-gem-install

otherwise it forces to the system default compiler which is clang.
Re: [picky:66] problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/21/12 5:51 PM
Thanks David for your patience and great work!

I'd like to find out what clang's problem is. Did you get any feedback at all? Is it harsher with warnings? (Yes, I need to remove that warning, but still)

For version 4.4.2, I added your suggestion, including some output which tells you which gcc was used. However, I need to investigate first: https://github.com/floere/picky/issues/81.

Cheers,
   Florian
Re: [picky:66] problems with gem installation with rvm and OS X Lion Picky / Florian Hanke 6/21/12 6:31 PM
P.S: Version 4.4.2 is released.