2

I cannot manage to build the rails sqlite3 gem. Whether I install sqlite3-ruby or just sqlite3, it fails the same. As sqlite3 was installed by macports, it's all in /opt/local. I use rvm. I'm on a newly updated OS X Mountain Lion Macbook.

flyer$ which sqlite3
/opt/local/bin/sqlite3
flyer$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-darwin11.4.0]
flyer$ rails -v
Rails 2.3.14

flyer$ gem install sqlite3-ruby -- --with-opt-dir
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

        /Users/russ/.rvm/rubies/ruby-1.8.7-p358/bin/ruby extconf.rb --with-opt-dir
/Users/russ/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/mkmf.rb:1164:in `dir_config': private method `split' called for true:TrueClass (NoMethodError)
    from /Users/russ/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/mkmf.rb:1745:in `init_mkmf'
    from /Users/russ/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/mkmf.rb:1770
    from extconf.rb:3:in `require'
    from extconf.rb:3
***dir_config: dir is true, target is opt, idefault is , ldefault is 

Gem files will remain installed in /Users/russ/.rvm/gems/ruby-1.8.7-p358/gems/sqlite3-1.3.6 for inspection.
Results logged to /Users/russ/.rvm/gems/ruby-1.8.7-p358/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out

That line that starts with ***dir_config: is the output of a puts statement I added just before mkmf.rb line 1164. Line 1164 is

defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)

Note that I cannot upgrade ruby or rails as I need to match my hosting provider's versions. I believe this had built before my Mountain Lion upgrade and I did install the latest XCode today.

I know this has to be my problem somehow (and I suspect it's something dumb), but I can't figure out how. Can anybody please help?

RussK
  • 199
  • 1
  • 17
  • This makes no sense to me at all. The second line of `dir_config` is `if dir = with_config(target + "-dir", (idefault unless ldefault))`. `with_config` returns a boolean. So the line in `with_config` that fails is indeed calling `split` on a boolean. How could this ever work? What am I missing? – RussK Aug 09 '12 at 21:30

1 Answers1

0

I don't have enough reputation to post a comment, so I guess I'll post this an a potentially unhelpful answer. Honestly I truly don't understand the error either, but I wonder if it might have something to do with either the Ruby version, or the OS. I've seen some folks saying something about issues with Mountain Lion in regards to native libraries. I found this answer on SO; I would try his second and third option (not the snow leopard one), and see if that makes any difference.

Community
  • 1
  • 1
Paul Richter
  • 10,908
  • 10
  • 52
  • 85
  • I got around the problem w/o actually solving it by installing sqlite3 without needing the --with-opt-dir (I don't recall exactly how). But no matter what version of OS or Ruby you're using, you can't call split on a boolean. Yet there it is in the code. – RussK Aug 23 '12 at 18:41