views:

273

answers:

3

I have installed the pg module with help of

gem install pg

Which returned

Successfully installed pg-0.8.0-x86-mswin32-60

When a .rb-file looks like this

require 'rubygems'
require 'pg'

I get an LoadError (exception 126) which tells me that it can't find the module C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.8.0-x86-mswin32-60/lib/pg.so.

I heard something about that it is a Linux compilation. I'm really stuck so I really welcome suggestions.

I have also installed PostgreSQL, I use Windows XP.

A: 

Perhaps it's not pg that's missing but some other dependency? Perhaps devkit?: http://blog.smajn.net/2009/07/installing-ruby-191-rails-232-and.html

lemonad
I have now installed devkit as the blogpost has suggested, but on Ruby 1.8.6.
Alexander
A: 

pg gem depends on PostgreSQL DLL being in the PATH.

In case the required DLL is not found, Ruby will throw a loading error about pg.so

Please check that PostgreSQL binaries and DLL are in the PATH:

SET PATH

Or copy the required DLL (pq.dll) has been copied to Ruby installation directory.

I recommend read this blog article about setting PostgreSQL with new RubyInstaller (One-Click Installer successor):

Install Ruby 1.9.1 and Rails 2.3.2 on Windows Vista

Hope that helps.

Luis Lavena
I have added the path but can't find the .dll-file you mention. Maybe I just try to reinstall everything as the blogpost suggest.
Alexander
A: 

I just wrestled with this myself.

1) Make sure C:\Program Files\PostgreSQL\8.4\bin is in your path (as Luis suggested) 2) Make sure the libeay32.dll and ssleay32.dll from C:\Program Files\PostgreSQL\8.4\bin are loaded first. In my case I copied them over from C:\ruby\bin, which (in my case) is first in my path.

I was getting errors like

The ordinal 4046 could not be located in dynamic link library LIBEAY32.dll and The ordinal 284 could not be located in the dynamic link library SSLEAY32.DLL

until I did step 2)

Good luck...