ERROR: Failed to build gem native extension

Hi,
I’m trtying to install postgress v0.7.9.2008.01.28 gems:

C:>gem install -v=0.7.9.2008.01.28 postgres
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install -v=0.7.9.2008.01.28 postgres
checking for main() in /ms/libpq.lib… no
Could not find PostgreSQL build environment (libraries & headers):
Makefile
not
created
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–srcdir=.
–curdir
–ruby=c:/ruby/bin/ruby
–with-pgsql-dir
–without-pgsql-dir
–with-pgsql-include
–without-pgsql-include=${pgsql-dir}/include
–with-pgsql-lib
–without-pgsql-lib=${pgsql-dir}/lib
–with-/ms/libpqlib
–without-/ms/libpqlib

Gem files will remain installed in
c:/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.9
.2008.01.28 for inspection.
Results logged to
c:/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.9.2008.01.28/ext/g
em_make.out

The mkmf.log file has following info:

have_library: checking for main() in /ms/libpq.lib…

no

“cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I.
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -MD -Zi -O2b2xg- -G6 conftest.c
msvcrt-ruby18-static.lib /ms/libpq.lib oldnames.lib user32.lib
advapi32.lib
ws2_32.lib -link -libpath:“C:/PROGRA~1/POSTGR~1/8.1/lib”
-libpath:“c:/ruby/lib” -stack:0x2000000”
checked program was:
/* begin /
1: /top/
2: int main() { return 0; }
3: int t() { main(); return 0; }
/
end */

“cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I.
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -MD -Zi -O2b2xg- -G6 conftest.c
msvcrt-ruby18-static.lib /ms/libpq.lib oldnames.lib user32.lib
advapi32.lib
ws2_32.lib -link -libpath:“C:/PROGRA~1/POSTGR~1/8.1/lib”
-libpath:“c:/ruby/lib” -stack:0x2000000”
checked program was:
/* begin /
1: #include <winsock2.h>
2: #include <windows.h>
3:
4: /top/
5: int main() { return 0; }
6: int t() { void ((volatile p)()); p = (void (()()))main; return 0;
}
/
end */


Can anyone help me??? I’m really strugling a lot.

Thanks in Advance!!!

You need to download windows-compiled gem with sth like ‘mswin32’ in
the name, becouse you use windows, don’t you?
Look here:
http://wiki.rubyonrails.org/rails/pages/PostgreSQL (scroll down and
then…)
http://glauche.de/2007/12/21/installing-native-postgres-gem-for-ruby/