Building postgresql on Windows

Hi all,

Windows 2000
Ruby 1.8.2 R7
ruby-postgres 0.7.1

I'm having some trouble installing the postgres driver on my Windows
box. I installed Postgres 8 Beta 1 using the Windows installer for
PostgreSQL. The problem seems to be that there's no pg.lib. I have a
libpg.dll and a libpg.a under the lib directory, but that's it.

Is it possible without the .lib file, or am I outta luck? Or, does
someone have a precompiled binary they could share with me?

Regards,

Dan

For future reference:

1) copy c:/program files/postgresql/8.1/lib/ms/libpq.lib to c:/program
files/postgresql/8.1/lib/pq.lib, replacing 8.1 with whatever your
version is, and adjusting the directory as needed.

(I'm not sure why PostgreSQL layed things out this way on Windows, nor
am I sure what libcpg.lib is.)

2) run: ruby extconf.rb --with-pgsql-dir=c:/progra~1/postgresql/8.1.

3) nmake
4) nmake install

If you need a compiler, start at
http://www.rubygarden.org/ruby?WindowsCompiler\. It's free.

Oddly, I could not get mkmf.rb to work with "have_library('ms/libpq')",
hence the reason I copied the .lib file. The real solution should be
to adjust extconf.rb to something like this, if someone can make it
work:

# Line 39 of the extconf.rb file in ruby-postgres
if have_library("pq", "PQsetdbLogin") || have_library("ms/libpq",
"PQsetdbLogin")

Regards,

Dan

Hi,

ยทยทยท

----- Original Message -----
From: "Daniel Berger" <djberg96@gmail.com>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Saturday, November 12, 2005 1:37 PM
Subject: Re: Building postgresql on Windows

>Hi all,

Windows 2000
Ruby 1.8.2 R7
ruby-postgres 0.7.1

I'm having some trouble installing the postgres driver on my Windows
box. I installed Postgres 8 Beta 1 using the Windows installer for
PostgreSQL. The problem seems to be that there's no pg.lib. I have a
libpg.dll and a libpg.a under the lib directory, but that's it.

Is it possible without the .lib file, or am I outta luck? Or, does
someone have a precompiled binary they could share with me?

Regards,

Dan

For future reference:

1) copy c:/program files/postgresql/8.1/lib/ms/libpq.lib to c:/program
files/postgresql/8.1/lib/pq.lib, replacing 8.1 with whatever your
version is, and adjusting the directory as needed.

(I'm not sure why PostgreSQL layed things out this way on Windows, nor
am I sure what libcpg.lib is.)

2) run: ruby extconf.rb --with-pgsql-dir=c:/progra~1/postgresql/8.1.

3) nmake
4) nmake install

If you need a compiler, start at
http://www.rubygarden.org/ruby?WindowsCompiler\. It's free.

Oddly, I could not get mkmf.rb to work with "have_library('ms/libpq')",
hence the reason I copied the .lib file. The real solution should be
to adjust extconf.rb to something like this, if someone can make it
work:

# Line 39 of the extconf.rb file in ruby-postgres
if have_library("pq", "PQsetdbLogin") || have_library("ms/libpq",
"PQsetdbLogin")

I made it work like this:

1) modify extconf.rb
# Line 36
    $LDFLAGS += "-link -libpath:#{libdir}"
# Line 39
  if have_library("libpq", "PQsetdbLogin")

2) run : ruby
extconf.rb --with-pgsql-include-dir=c:/progra~1/postgresql/8.1/include --with-pgsql-lib-dir=c:/progra~1/postgresql/8.1/lib/ms

3) nmake
4) nmake install

Regards,

Park Heesob