自從我從Lion升級到Mountain Lion後,我一直試圖讓我的Rails開發環境備份。問題是特別安裝pg-0.14.0(postgresql)gem。Mountain Lion安裝後無法安裝postgresql gem
我試過這個post的指示,但沒有運氣。我試圖用Homebrew卸載Postgres,然後重新安裝它。沒有任何工作。如果我嘗試安裝這個寶石我收到此錯誤:
Building native extensions. This could take a while...
ERROR: Error installing pg: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.
我在哪裏可以找到mkmf.log
?任何人都可以給我一個關於如何再次安裝pg gem的建議嗎?
更新 我能夠用找到我的mkmf.log文件:
find/-name mkmf.log 2>/dev/null
有類似下面的幾個失敗xcrun電話:
have_library:在檢查的PQconnectdb() -llibpq ... --------------------否
"xcrun cc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/Cellar/postgresql/9.1.4/include -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -L/usr/local/Cellar/postgresql/9.1.4/lib -lruby -llibpq -lpthread -ldl -lobjc " ld: library not found for -llibpq clang: error: linker command failed with exit code 1 (use -v to see invocation)
爲什麼在運行xcrun時出現錯誤?有沒有人看過這個?
謝謝!
感謝您的回覆。運行gem install pg -v'0.14.0'可以毫無誤差地安裝gem。但是,運行軟件包安裝會導致我發佈的錯誤。當我嘗試在同一個目錄中找到mkmf.log文件時,我已經運行了上述兩個命令..找不到它。 – Nick 2012-08-08 04:54:42
@Nick恐怕你不在我的Ruby + Mac OS X知識範圍之內。做一些挖掘以查看bundle命令是否正在某處的臨時編譯目錄中運行。如果您願意等待,請運行find/-name mkmf.log 2>/dev/null來搜索整個系統,從而抑制權限錯誤。 – 2012-08-08 05:01:04
我會那樣做的。謝謝。 – Nick 2012-08-08 05:03:18