【问题标题】:Can't install pg gem on Yosemite无法在优胜美地上安装 pg gem
【发布时间】:2015-08-11 04:24:17
【问题描述】:

我正在尝试在优胜美地捆绑安装我的 Gemfile,我列出了 pg,但我收到此错误:

使用原生扩展安装 pg 0.18.1

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/Apple/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150811-78520-18pzkkt.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/php5/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... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQhostaddr()... no
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
linking shared-object pg_ext.bundle
couldn't understand kern.osversion `14.1.0'
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
Makefile:253: recipe for target 'pg_ext.bundle' failed
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/Apple/.rvm/gems/ruby-2.2.2@/gems/pg-0.18.1 for inspection.
Results logged to /Users/Apple/.rvm/gems/ruby-2.2.2@/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.

有人可以帮忙吗?

【问题讨论】:

    标签: ruby rvm pg osx-yosemite


    【解决方案1】:

    在我发现这个之前,我在新的 SO 中安装 pg gem 时遇到了很多问题:

    bundle failing - Can't find the PostgreSQL client library (libpq)

    希望对你有所帮助。

    【讨论】:

    • 这个答案解决了我的问题:stackoverflow.com/questions/27047463/…
    • 像这样:MACOSX_DEPLOYMENT_TARGET=10.9 ARCHFLAGS="-arch x86_64" bundle install --without production
    • 我得到了完全相同的错误消息(由于尝试制作 pg_ext.bundle 时链接失败),但设置 MACOSX_DEPLOYMENT_TARGET 对我不起作用。当我升级 XCode 命令行工具(基于 XCode 7.0.1)时,我保留了 OSX 10.10.2。我终于下载了整个 XCode 工具,并升级到 10.10.5,瞧—— gem install pg 工作了。故事的寓意:安装带有原生扩展的 pg 时,请确保原生用户开心!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 2015-06-02
    • 1970-01-01
    相关资源
    最近更新 更多