Iconv (& sqlite) problems on Leopard: Ruby 1.9.1/Rails 2.3.2


#1

I have both a PPC Mac and an Intel Mac, and I recently installed Ruby
1.9.1 from source on both the same way, and Rails 2.3.2. I’m trying to
run a Rails app locally that’s set to use sqlite3.

This is a side question, not the main issue: on the PPC mac, when I
started the server, I got errors about sqlite3 not existing. I was able
to fix that by doing “sudo gem install sqlite3-ruby”. This didn’t happen
on the Intel mac. Why did I have to do that?

On the Intel mac, when I try to start the server, I get this:
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/inflector.rb:3:in
require': no such file to load -- iconv (LoadError) from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/inflector.rb:3:in<top (required)>’
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/integer/inflections.rb:1:in
require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/integer/inflections.rb:1:in<top (required)>’
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/integer.rb:2:in
require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/integer.rb:2:in<top (required)>’
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext.rb:3:in
require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext.rb:3:inblock in <top (required)>’
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext.rb:1:in
each' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext.rb:1:in<top (required)>’
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support.rb:55:in
require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support.rb:55:in<top (required)>’
from
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/commands/server.rb:1:in
require' from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/commands/server.rb:1:in<top (required)>’
from script/server:3:in require' from script/server:3:in

And this doesn’t happen on the PPC mac. On PPC, when I run “gem which
iconv”, I get
/usr/local/lib/ruby/1.9.1/powerpc-darwin9.6.0/iconv.bundle. When I run
that on the Intel mac, I get “Can’t find ruby library file or shared
library iconv”. (Using the old preinstalled 1.8 version of ruby, the
path to the iconv bundle that’s in …/Ruby.framework/… shows up, on
both computers.) I checked the
/usr/local/lib/ruby/1.9.1/i386-darwin9.6.0/ folder on the Intel mac, and
iconv.bundle is not there. Why is this happening? How can I fix it —
where can I get iconv?

Thanks.


#2

On Apr 26, 2009, at 4:34 PM, Jacob Bandes-storch wrote:

I have both a PPC Mac and an Intel Mac, and I recently installed Ruby
1.9.1 from source on both the same way, and Rails 2.3.2. I’m trying to
run a Rails app locally that’s set to use sqlite3.

This is a side question, not the main issue: on the PPC mac, when I
started the server, I got errors about sqlite3 not existing. I was
able
to fix that by doing “sudo gem install sqlite3-ruby”. This didn’t
happen
on the Intel mac. Why did I have to do that?

My leading guess would be that your path is different on the two
machines. On one, it found the Ruby interpreter you expected, but on
the other it found one without the gem installed because of the way
the path was set. Another option is that both Ruby interpreters had
the gem installed on one box, but not the other.

On the Intel mac, when I try to start the server, I get this:
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/
active_support/inflector.rb:3:in
`require’: no such file to load – iconv (LoadError)

where can I get iconv?
The standard iconv library ships with Ruby, so you shouldn’t need to
install it on either version. It’s part of Ruby’s standard library.

I’m not sure why Rails fails to find it, that being the case. You’re
install obviously isn’t what I expect it to be.

James Edward G. II


#3

My leading guess would be that your path is different on the two
machines. On one, it found the Ruby interpreter you expected, but on
the other it found one without the gem installed because of the way
the path was set. Another option is that both Ruby interpreters had
the gem installed on one box, but not the other.
The paths are about the same, both having /usr/local/bin:/usr/bin:/bin
at the beginning, so I don’t know how that would happen. The Ruby
interpreter on both is the same, 1.9.1p0.

The standard iconv library ships with Ruby, so you shouldn’t need to
install it on either version. It’s part of Ruby’s standard library.

I’m not sure why Rails fails to find it, that being the case. You’re
install obviously isn’t what I expect it to be.
That’s odd. Both were configured with --enable-shared --enable-pthread
CFLAGS=-D_XOPEN_SOURCE=1 (from
http://hivelogic.com/articles/view/ruby-rails-leopard). Is that helpful
at all? How would I go about figuring out why it didn’t install iconv on
the one machine?

Another thing I just noticed is that when I run ruby script/console on
the Intel mac, I get:
Loading development environment (Rails 2.3.2)
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.2/lib/active_record/i18n_interpolation_deprecation.rb:23:in
<class:Simple>': undefined methodalias_method_chain’ for
I18n::Backend::Simple:Class (NoMethodError)
Whereas it works on the PPC mac. Is this related? Or is something really
broken?