【问题标题】:gem install pg error: couldn't understand kern.osversion `14.0.0' on Yosemite w/ Ruby 2.1.5gem install pg 错误:在 Yosemite w/Ruby 2.1.5 上无法理解 kern.osversion `14.0.0'
【发布时间】:2015-01-18 18:41:09
【问题描述】:

我使用 RVM 安装 Ruby-2.1.5 并再次运行 bundle。现在 pg gem 将无法安装,我收到此错误:

gem install pg -v '0.17.1' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/diego/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20141120-33258-108chh6.rb extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/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 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 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_connection.c
compiling pg_errors.c
compiling pg_result.c
linking shared-object pg_ext.bundle
couldn't understand kern.osversion `14.0.0'
ld: warning: directory not found for option '-L/Users/mpapis/.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
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

我已通过 App Store 将 XCode 更新到 6.1 版。我通过自制软件重新安装了 gcc 和 applegcc-4.2。我还重新安装了 Postgres.app。我已经尝试了建议的解决方案 herehere 无济于事。

有人知道接下来要尝试什么吗?现在我只是恢复到 pg 安装良好的 Ruby-2.1.4。

【问题讨论】:

  • 您是否尝试过 brew update 更新公式和 Homebrew 本身以及 rvm cleanup all 删除陈旧的 ruby​​ 文件夹...?
  • 原生扩展通常依赖于可用的系统工具。现在,依赖项必须由 xode-commandline-tools 提供。试试看,xcode-select --install 。它似乎与stackoverflow.com/q/26486163 非常相似
  • 我尝试了 brew update 和 rvm cleanup。 Xcode select 是我尝试的第一件事,它只是退出并显示一条消息,提示已安装,通过软件更新进行更新。后来就这样做了。还是一样的错误:(
  • 你试过PG的0.18.0.pre release吗?
  • 那是什么来源?我在尝试 gem 安装该版本时遇到错误:gem install pg -v '0.18.0.pre' ERROR: Could not find a valid gem 'pg' (= 0.18.0.pre) in any repository ERROR: Possible alternatives: pg

标签: ruby macos postgresql gcc


【解决方案1】:

如果您在编译 pg gem 之前在您的环境中设置了 MACOSX_DEPLOYMENT_TARGET=10.9,则共享对象链接应该可以正常工作。

【讨论】:

  • 只是为了记录export MACOSX_DEPLOYMENT_TARGET=10.9
猜你喜欢
  • 2015-09-24
  • 1970-01-01
  • 2016-04-11
  • 1970-01-01
  • 2015-11-29
  • 1970-01-01
  • 2014-03-30
  • 1970-01-01
  • 2015-03-24
相关资源
最近更新 更多