sqliteruby-on-rails-3.1osx-leopard

Help to fix strange sqlite3 error - dyld: Library not loaded: /usr/lib/libsqlite3.0.dylib


I am suddenly getting an sqlite3 error:

ActionView::Template::Error (dyld: Library not loaded: /usr/lib/libsqlite3.0.dylib
Referenced from: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
Reason: no suitable image found.  Did find:
        /usr/lib/libsqlite3.0.dylib: mach-o, but wrong architecture
        /usr/local/lib/libsqlite3.0.dylib: mach-o, but wrong architecture
        /usr/lib/libsqlite3.0.dylib: mach-o, but wrong architecture

I have no idea why I am suddenly getting this error. Rails 3.1.0 and Ruby 1.9.2 Mac OSX 10.5.8


Solution

  • Okay so this is a messed up sqlite3 install and it seems that lots of people run into this problem but solutions are a little hard to come by. After a lot of googling I did the following:

    Step1: went to http://www.sqlite.org/download.html and downloaded sqlite-autoconf-3070800.tar.gz under source code

    Step2: expand file and cd into the resultant directory

    Step3: sudo CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64' ./configure --disable-dependency-tracking

    Step4: sudo make install

    Step5: added /usr/local/lib to the path

    I was doing an awful lot of tinkering during this time. It's possible that I have done something else along the way and not realized and not included it here. But these steps seemed to fix the problem for me.

    My environment: Mac OSX 10.5.8 MacBookPro4, Intel Core 2 Duo, 2.5 GHz