2014-09-26 133 views
1

我正在學習R o R.然後,我想通過使用postgresql製作一個網站。 但是,這個錯誤讓我發瘋。 請幫幫我!無法捆綁安裝,因爲'pg'

$ sudo bundle install 

creating Makefile 

make "DESTDIR=" 
compiling gvl_wrappers.c 
compiling pg.c 
compiling pg_connection.c 
pg_connection.c:2323:3: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration] 
       gettimeofday(&currtime, NULL); 
       ^
1 warning generated. 
compiling pg_errors.c 
compiling pg_result.c 
linking shared-object pg_ext.bundle 
ld: file not found: dynamic_lookup 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make: *** [pg_ext.bundle] Error 1 

Gem files will remain installed in /Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1 for inspection. 
Results logged to /Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1/ext/gem_make.out 
An error occurred while installing pg (0.17.1), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling. 

我嘗試了所有可能的方式。

例如,我試圖改變pg的傳遞。 但是,我不能。

然後,我試過

$ brew update 
$ brew uninstall postgresql 
$ brew install postgresql 
$ gem install pg 
$ bundle install 

但是,它沒有工作。

我該怎麼辦這個錯誤!?

+0

你應該考慮使用像'rvm'或'rbenv'。你不需要擔心使用'sudo'來安裝任何東西。 – 2014-09-26 14:47:43

+0

OP *是*使用RBEnv,只是不正確。 *永遠不要使用'sudo'來搭配RBEnv或RVM託管的Ruby。 – 2014-09-26 15:32:54

+0

「它沒有用」是什麼意思?它靜靜地死了?它給了你一個錯誤輸出,但你不明白嗎?我們需要更多關於輸出內容的信息。 – 2014-09-26 15:37:53

回答

1

您可能需要libpq-dev,這是在試圖在新機器上安裝pg gem時總是能找到我的庫。

+0

錯誤:沒有可用的公式libpq-dev 搜索水龍頭... Yamaguchi-no-MacBook-Pro:IPnexus Sean $ My Os是mac。 – 2014-10-01 08:58:32

+0

@shion它仍然不適合你?我有一個非常類似的問題,最終在完全重新啓動並重新嘗試上面的brew更新等後,它工作。 – Jaime 2014-10-10 20:54:09

0

我使用Ruby 2.2.1

運行PG寶石0.17來襲時,同樣的問題,我只是做了bundle update pg並將其升級到0.18,不再有這個問題,編譯