Search code examples
ruby-on-railsruby64-bitlibrariespg

rails s error libpq.so.5: wrong ELF class: ELFCLASS64


I am getting the subject error.

It seems the error has something to do with the postgres libraries not being 64 bit, but other than that I can't figure it out. Bundle install runs alright, but when I run rails s, I get:

jim@MJTPUB:~/rails/apps/apoxeia$ rails s
/home/jim/.rvm/gems/ruby-1.9.3-p194@rails328/gems/pg-0.15.1/lib/pg.rb:4:in `require':
libpq.so.5: wrong ELF class: ELFCLASS64 - /home/jim/.rvm/gems/ruby-1.9.3-p194@rails328
/gems/pg-0.15.1/lib/pg_ext.so (LoadError) 
from /home/jim/.rvm/gems/ruby-1.9.3-p194@rails328/gems/pg-0.15.1/lib/pg.rb:4:in 
`<top (required)>'

Where do I start to figure this out?

Thanks - Jim


Solution

  • This is caused by your linker being unable to link the libraries together because one is 32-bit and one is 64-bit. The fix is simple: Make sure you have installed all the appropriate pieces on the same architecture (standardize on 32-bit or 64-bit). If that fails, then check your build environment and see what it is targetting.

    If that fails it may be a problem with your build environment, or the make files of the bundle or any number of other things. You will need to take a close look at these things (and possibly provide a lot more information).