2010-12-21 80 views
1

爲了我不斷的驚愕,我不得不在Windows上編程。我試圖爲一些Ruby開發安裝postreSQL。在Windows XP上的gem install pg

[email protected] /c/rubyDev 
$ gem install pg 
Building native extensions. This could take a while... 
ERROR: Error installing pg: 
     ERROR: Failed to build gem native extension. 

c:/Ruby192/bin/ruby.exe extconf.rb 
checking for pg_config... yes 
*** 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 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=c:/Ruby192/bin/ruby 
     --with-pg 
     --without-pg 
     --with-pg-config 
     --without-pg-config 
extconf.rb:33:in ``': No such file or directory - c:\Program Files\PostgreSQL\8.3\bin/pg_config.exe --cflags (Errno::ENOENT) 
     from extconf.rb:33:in `<main>' 

它是什麼樣子,在我看來它顯示對C路徑:\ Program Files文件... \ BIN/pg_config.exe有錯誤的路徑分隔符。望着它是建設有

ENV['PATH'] = "#{pgdir}/bin" + File::PATH_SEPARATOR + ENV['PATH'] 

這條道路在哪裏文件:: PATH_SEPARATOR定義的extconf.rb,爲什麼是不正確的,是有可能解決?

+0

[無法在Windows上安裝pg gem]( http://stackoverflow.com/questions/4335750/cant-install-pg-gem-on-windows) – Phrogz 2010-12-29 06:40:42

回答

0

你得到的信息是,你可能沒有正確安裝該寶石的東西清楚地表明:

無法創建Makefile文件由於某些原因,可能是缺乏必要的庫和/或頭。檢查mkmf.log文件以獲取更多詳細信息。您可能需要配置選項。

昨天發佈的最新版本的pg(0.10.0)沒有Windows本地版本,但如果您安裝0.9.0,它應該安裝二進制文件而不會出現問題。

無論如何,如果你想安裝gem,你需要安裝一個構建環境。如果您使用RubyInstaller,那麼你需要的devkit

安裝創業板將只需要你提供寶石安裝附加選項(如--with-PG-DIR)

SUBST X:「C: \ Program Files(x86)\ PostgreSQL \ 8.3「 gem install pg - --with-pg-dir = X: subst X:/ D