• 締切済み

ruby-postgresのインストール方法

ruby-postgresをインストールしたいのですが、うまくいきません。 コマンドプロンプト上で >gem install ruby-postgres と入力したのですが、 ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/ruby-postgres- 0.7.1.2005.11.23 for inspection. というエラーメッセージが出てしまいます。 また、 Results logged to c:/ruby/lib/ruby/gems/1.8/gems/ruby-postgres-0.7.1.2005.11.23/gem_make.out と書いてあったのでログも確認しましたが、 このファイルには何も書かれていませんでした。 どなたか、ruby-postgresのインストール方法を知っている方いらっしゃれば、教えて頂けると嬉しいです。 宜しくお願い致します。

  • Ruby
  • 回答数3
  • ありがとう数20

みんなの回答

  • lv4u
  • ベストアンサー率27% (1862/6715)
回答No.3

質問者さんの例であるruby-postgresは、私の環境だとすんなりインストールされました。 でも、 >gem install sqlite3-ruby では、失敗しました。 どこかに問題があるのでしょうが、とりあえずの解決方法は、インストールされるべきファイルが何かを調べて、そのファイルをRubyのサイトからダウンロードし、例えば、c:\Rubyの下に保存しておいて C:\Ruby> gem install ruby-postgres とすれば、良いのではないでしょうか? ちなみに私の場合は、デフォルトのSQLite3を使おうとして gem install sqlite3-rubyが処理の途中でエラーを出し、そのままブラウザから呼び出すと MissingSourceFile (no such file to load -- sqlite3): となってしまいました。なので、必要なファイルである 「sqlite3-ruby-1.2.1-mswin32.gem」を http://rubyist.g.hatena.ne.jp/muscovyduck/20070325/p2 からダウンロードしてC:\Rubyの下に保存して、gem install sqlite3-rubyを実行することで、インストールが成功して、SQLite3がやっと使えるようになりました。

nancykiwi
質問者

お礼

ありがとうございます。 ruby-postgresをインストールするのに必要なファイルをもう一度調べてみます。

noname#149362
noname#149362
回答No.2

これは恐らく、MS-Windows 用のバイナリが用意されている gem でコンパイルが不要であってもコンパイラが呼び出されてしまう、というバグです。参考 URL にある通り、RubyGems 1.2.0 の時に報告されています。 お使いの RubyGems のバージョンはいくつでしょうか。私の手元の RubyGems は 1.3.0 (OS は MS-Windows XP) でして、 >gem install ruby-postgres とやって成功しています。ただし、このところのバージョンの RubyGems は MS-Windows 上で少々挙動がおかしく、もしかしたら RubyGems のバージョンを上げる時に失敗するかも知れません。(失敗した場合は Ruby から再インストールすることになる可能性があります。) もう1つの対処法は、参考 URL にある通り、Microsoft Visual C++ 2008 Feature Pack Redistributable Package (vcredist_x86) をインストールするという方法のようです。(私は試していないのでうまくいくかどうか分かりません。)

参考URL:
http://rubyforge.org/tracker/index.php?func=detail&aid=22021&group_id=126&atid=575
nancykiwi
質問者

お礼

ありがとうございます。大変参考になりました。 バージョンを新しくするために、インストールし直し、再度挑戦することに致しました。

  • sakusaker7
  • ベストアンサー率62% (800/1280)
回答No.1

>ERROR: Failed to build gem native extension. >Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/ruby-postgres- この辺から推察して、Windows用のrubyをお使いと思いますが、 コンパイラはありますか? ruby本体のコンパイルに使われたものと同じもの(バージョンも同じ)が 使用可能でないと、Cで書かれた拡張ライブラリをインストールことはできません。

nancykiwi
質問者

お礼

ありがとうございます。 まだまだ未熟者でして、コンパイラというものがしっかり理解できていないのですが、確認してみます。

関連するQ&A

  • Rubricks の環境を作ろうと思うのですが。。

    タイトルにあるとおりRubricks の環境を作ろうと思うのですが、、 Mongrel 1.1.2のインストール gem install mongrel -v 1.1.2 -y を行うと、 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 mongrel -v 1.1.2 -y creating Makefile nmake 'nmake' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/fastthread-1.0 .1 for inspection. Results logged to c:/ruby/lib/ruby/gems/1.8/gems/fastthread-1.0.1/ext/fastthread /gem_make.out と言うエラーが表示されます。 どのように対処したらよいのか分かりません。 詳しい方、よろしくお願いします。。

    • ベストアンサー
    • Ruby
  • ruby1.9からtwitterライブラリをインストールするとエラーに

    ruby1.9からtwitterライブラリをインストールするとエラーになってしまいます。 環境はWinxpです。 H:\Program Files\Ruby-1.9.1\bin>gem install twitter と、すると、以下のエラーメッセージが・・・。 Building native extensions. This could take a while... ERROR: Error installing twitter: ERROR: Failed to build gem native extension. "H:/Program Files/Ruby-1.9.1/bin/ruby.exe" extconf.rb install twitter creating Makefile nmake 'nmake' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 Gem files will remain installed in H:/Program Files/Ruby-1.9.1/lib/ruby/gems/1.9 .1/gems/yajl-ruby-0.7.5 for inspection. Results logged to H:/Program Files/Ruby-1.9.1/lib/ruby/gems/1.9.1/gems/yajl-ruby -0.7.5/ext/gem_make.out ------------------- ちなみに、 H:\Program Files\Ruby-1.9.1\bin>gem install twitter4r とすると、インストールは出来ます。 ただ、requireでtwitterを読み込もうとすると 「msvcrt-ruby18.dllがありません」 と言うエラーになってしまいます。 助けていただければ幸いです。

    • ベストアンサー
    • Ruby
  • Passengerがインストールできない。。。

    Apache上にて Railsアプリケーションを動作させたいために、 Apacheのモジュールである、”Phusion Passenger”をインストールしようと思ったのですが、 C:\>gem install passengerにて以下のエラーがでます。 ************↓ここから**************************************** Building native extensions. This could take a while... ERROR: Error installing passenger: ERROR: Failed to build gem native extension. c:/ruby/bin/ruby.exe extconf.rb install passenger creating Makefile nmake Microsoft(R) Program Maintenance Utility Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. cl -nologo -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1. 8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tcnative_support.c cl : コマンド ライン warning D9035 : オプション 'Og-' の使用は現在推奨されていま せん。今後のバージョンからは削除されます。 cl : コマンド ライン warning D9002 : 不明なオプション '-G6' を無視します native_support.c native_support.c(22) : fatal error C1083: include ファイルを開けません。'sys/un. h': No such file or directory NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\c l.EXE"' : Stop. Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/passenger-2.0. 6 for inspection. Results logged to c:/ruby/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/passenger/g em_make.out ************↓ここまで**************************************** 環境変数などの問題かとも思いましたが。。。bin/lib/includeのパスも追加しましたがダメでした。 是非この問題の対応が分かる方は教えて下さい。 環境:: OS:Windows XPPro SP3 ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] Rails 2.3.0 gem 1.3.1

  • Mac OSXにgem mysqlが入らない

    Mac OSX Lionにgem mysqlが入らなくて困っています。 (MySQL自体は普通にインストールしました) ネット上を探しまわって以下のようなコマンドを試したのですが、 エラーメッセージは同様のものでした。 sudo gem install mysql sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config 以下、エラーメッセージです。 Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out 完全に詰まってしまいました。 何かアドバイスをお願いいたします。

    • ベストアンサー
    • Ruby
  • gemでmechanizeをインストールが失敗しま

    Rubyのライブラリをインストールするのに使う、「gem」についての質問です。 ちなみに、Windows 7の64bitを使っています。 ウェブブラウザエミュ系のライブラリを使いたく、 gemでMechanizeをインストールしようとしたのですが失敗します・・・。 gem install Mechanize をしようとすると、以下のようになります。 お助けを・・・。 C:\windows\system32>gem install Mechanize ERROR: Could not find a valid gem 'Mechanize' (>= 0) in any repository ERROR: Possible alternatives: mechanize C:\windows\system32>gem install mechanize Building native extensions. This could take a while... ERROR: Error installing mechanize: ERROR: Failed to build gem native extension. C:/Ruby200-x64/bin/ruby.exe -r ./siteconf20140719-13616-a69xok.rb extconf.rb checking for main() in -lstdc++... *** 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:/Ruby200-x64/bin/ruby --with-stdc++lib --without-stdc++lib C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to ge nerate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:534:in `try_link' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:720:in `try_func' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:950:in `block in have_library ' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for ' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in p ostpone' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:310:in `open' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:310:in `open' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:336:in `postpone' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:945:in `have_library' from extconf.rb:2:in `<main>' extconf failed, exit code 1 Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/unf_e xt-0.0.6 for inspection. Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0. 0/unf_ext-0.0.6/gem_make.out

    • ベストアンサー
    • Ruby
  • Ruby on Railsのインストールについて

    Ruby on Railsのインストールをしています。 そこで、gemのインストールまではいきついたのですが、RMagickのインストールに失敗します。 失敗時のログは以下です。 --------------------------------------------------------------------------------- [manabix]# gem install rmagick --no-ri --no-rdoc -v 2.12.2 Building native extensions. This could take a while... /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:46: warning: Insecure world writable dir /usr/local in PATH, mode 040777 ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... yes checking for ImageMagick version >= 6.3.5... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes checking for InitializeMagick() in -lMagickCore... no checking for InitializeMagick() in -lMagick... no Can't install RMagick 2.12.2. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information. *** 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=/usr/local/bin/ruby --with-MagickCorelib --without-MagickCorelib --with-Magicklib --without-Magicklib Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2/ext/RMagick/gem_make.out --------------------------------------------------------------------------------- どうすれば、うまくRMagickをインストールできますでしょうか?

  • rubyのWatirでIEが起動しない。

    rubyのWatirでIEが起動しない。 こんにちは rubyをはじめて使ってみたものです。 自動化のためにWatirを使用したいです。 インストールは無事終わっていますが、サンプルプログラムを叩くと以下の様なエラーが出てしまいにっちもさっちも行きません。 IEも起動できません。 どなたか助けていただけると本当にうれしいです。 サンプルプログラム require 'watir' agent = Watir::IE.start "http://www.google.co.jp/" ruby.exe -コンポーネントが見つかりません msvcrt-ruby18.dllが見つからなかったため、このアプリケーションを開始できませんでした。アプリケーションをインストールしなおすとこの問題は解決される場合があります。 C:/Ruby191/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/api.rb:1:in `r equire': 126: 指定されたモジュールが見つかりません。 - C:/Ruby191/lib/ruby/gem s/1.9.1/gems/win32-api-1.4.6-x86-mingw32/lib/win32/api.so (LoadError) from C:/Ruby191/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/a pi.rb:1:in `<top (required)>' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/windows-pr-1.0.9/lib/windows/er ror.rb:12:in `require' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/windows-pr-1.0.9/lib/windows/er ror.rb:12:in `<top (required)>' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/win32-process-0.6.2/lib/win32/p rocess.rb:1:in `require' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/win32-process-0.6.2/lib/win32/p rocess.rb:1:in `<top (required)>' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/watir-1.6.5/lib/watir/ie-proces s.rb:1:in `require' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/watir-1.6.5/lib/watir/ie-proces s.rb:1:in `<top (required)>' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/watir-1.6.5/lib/watir/ie.rb:45: in `require' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/watir-1.6.5/lib/watir/ie.rb:45: in `<top (required)>' from gui.rb:2:in `<main>' rubyのバージョンは C:\ruby>ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] です。 One-Click Ruby Installer for Windowsを使用してインストールしました。 watirは以下のURL通りにインストールしました。 gem update --system gem install watir http://www.sixapart.jp/techtalk/2008/06/watir_1.html OSはwindowsXP SP2です。 どなたか本当に助けていただけると感謝でいっぱいの気持ちになります。 どうぞよろしくお願いいたします。

    • ベストアンサー
    • Ruby
  • rubygemsとruby twitter gem ライブラリーを読み

    rubygemsとruby twitter gem ライブラリーを読み込もうとすると エラーになってしまいます。 ------ require 'rubygems' require 'twitter' エラーメッセージ H:\Program Files\Ruby-1.9.1\bin>gem ruby 1.rb ERROR: While executing gem ... (RuntimeError) Unknown command ruby H:\Program Files\Ruby-1.9.1\bin> ------------------- Winxpです。 ご指導のほどお願いします。

    • ベストアンサー
    • Ruby
  • rubyでrequireできない

    gemを使ってmechanizeをインストール完了までいったのですが、ruby実行時にrequire 'mechanize'で落ちてしまいます。 --sample.rb-- require 'rubygems' require 'mechanize' #require 'mechanize-2.7.3' p 'OK' 結果 /home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mechanize (LoadError) from /home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' from sample.rb:2:in `<main>' 現在のgem listでmechanizeは出てきましたので、gemのインストールは上手くいってます。 mechanize (2.7.3) ただLOAD_PATHをみてみると、 ["/home/USERNAME/.rbenv/rbenv.d/exec/gem-rehash", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/x86_64-linux", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/site_ruby", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/vendor_ruby/2.1.0", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/vendor_ruby/2.1.0/x86_64-linux", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/vendor_ruby", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/2.1.0", "/home/USERNAME/.rbenv/versions/2.1.5/lib/ruby/2.1.0/x86_64-linux"] でgemによってインストールされたlibが /var/lib/gems/1.9.1/gems/mechanize-2.7.3/lib/ LOAD_PATHにないことが原因かもしれないですが、対処法が分からず困ってます。 どなたかご回答願いします。 尚rubyのバージョンは ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

  • レンタルサーバでruby date2

    レンタルサーバでdate2(http://www.funaba.org/ruby.html#date2)ってライブラリを使いたいです。 ファイルをダウンロードしてtar -xvfしてREADMEに従ってくと、 %ruby install.rb install rm -f InstalledFiles ---> lib mkdir -p /usr/local/lib/ruby/site_ruby/1.8 install date.rb /usr/local/lib/ruby/site_ruby/1.8/ install.rb:633:in `initialize': Permission denied - /usr/local/lib/ruby/site_ruby/1.8/date.rb (Errno::EACCES) 以下略 となりました。レンタルサーバなので/usr/localなどに書き込み権限がないからの様です。 こういうライブラリをレンタルサーバで使いたい時って、どうしたら良いのでしょう?? 因に、今まではgem でインストールするライブラリしか使った事がなく、 gemの時は、 setenv GEM_HOME $HOME/local/lib/gems/1.8 setenv RB_USER_INSTALL true gem18 install hogehoge などとしてました。 ご指導の程、よろしくお願いいたします。

    • ベストアンサー
    • Ruby