README-Windows.rdoc instructions + MSVC 9 failing to compile

Issue #235 wontfix
Nathan Bush created an issue

Trying to build the gem for Ruby 1.9.3, built with MSVC 9.

C:\Users\[user]>gem fetch pg
C:\Users\[user]>gem unpack pg-0.18.4.gem
C:\Users\[user]>cd pg-0.18.4
C:\Users\[user]\pg-0.18.4>gem install hoe rake-compiler rdoc
C:\Users\[user]\pg-0.18.4>rake --with-pg-dir=c:/PMT/PgSQL946
  invalid option: --with-pg-dir=c:/PMT/PgSQL946
C:\Users\[user]\pg-0.18.4>rake newb --with-pg-dir=c:/PMT/PgSQL946
  invalid option: --with-pg-dir=c:/PMT/PgSQL946

Rake isn't liking any options I try and pass to it.

If I try adding Postgres to PATH in console, i.e.

set PATH=C:\PMT\PgSQL946;C:\PMT\PgSQL946\bin;C:\PMT\PgSQL946\include;%PATH%
C:\Users\[user]\pg-0.18.4>rake
Cross-compilation disabled -- rake-compiler not properly installed
cd tmp/i386-mswin32_90/pg_ext/1.9.3
C:/PMT/Ruby193p551x86/bin/ruby.exe -I. ../../../../ext/extconf.rb
checking for pg_config... yes
Using config values from C:\PMT\PgSQL946\bin/pg_config.exe
*** ../../../../ext/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=../../../../ext
        --curdir
        --ruby=C:/PMT/Ruby193p551x86/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
C:/PMT/Ruby193p551x86/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler faile
d to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/PMT/Ruby193p551x86/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
        from C:/PMT/Ruby193p551x86/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
        from ../../../../ext/extconf.rb:36:in `<main>'
rake aborted!
Command failed with status (1): [C:/PMT/Ruby193p551x86/bin/ruby.exe -I. ../...]

Tasks: TOP => default => spec => compile => compile:i386-mswin32_90 => compile:p
g_ext:i386-mswin32_90 => copy:pg_ext:i386-mswin32_90:1.9.3 => tmp/i386-mswin32_9
0/pg_ext/1.9.3/pg_ext.so => tmp/i386-mswin32_90/pg_ext/1.9.3/Makefile
(See full trace by running task with --trace)

...PATH does not seem to have any positive effect.

Rake version is 10.5.0, if that makes any difference.

Comments (2)

  1. Lars Kanis

    You need to separate extconf options per double-dash like this: rake -- --with-pg-dir=...

    Look into the mkmf.log file, that is mentioned in the output, to diagnose extconf issues.

    Unfortunately none of the ruby-pg maintainers uses MSVC with Ruby. So, we are pleased to receive pull requests, but don't do regular tests on that platform.

  2. Log in to comment