【问题标题】:Ruby on Rails - Error installing bdb. Failed to build gem native extensionRuby on Rails - 安装 bdb 时出错。构建 gem 原生扩展失败
【发布时间】:2011-11-09 16:17:12
【问题描述】:

运行gem install bdb 时出现以下错误:

Error installing bdb:
ERROR: Failed to build gem native extension.

有人知道我在哪里可以找到 Mac OS X 的 bdb 库吗?

完全错误:

Building native extensions.  This could take a while...
ERROR:  Error installing bdb:
ERROR: Failed to build gem native extension.
...
checking for db_version() in -ldb-5.1... yes
Writing bdb_aux._c (defines), this takes a while
don't know how to handle DB_DEGREE_2 DB_READ_COMMITTED, guessing UINT
don't know how to handle DB_DIRTY_READ DB_READ_UNCOMMITTED, guessing UINT
don't know how to handle DB_HEAP_RID_SZ (sizeof(db_pgno_t) + sizeof(db_indx_t)), guessing UINT

wrote 491 defines
creating Makefile

make
...
bdb.c:84:1: warning: "eDbE_create" redefined
bdb.c:50:1: warning: this is the location of the previous definition
bdb.c: In function ‘assoc_rescue’:
bdb.c:1200: warning: format not a string literal and no format arguments
bdb.c: In function ‘assoc_callback’:
bdb.c:1248: warning: comparison between signed and unsigned
bdb.c:1249: warning: pointer of type ‘void *’ used in arithmetic
bdb.c: In function ‘env_set_cachesize’:
bdb.c:1830: warning: implicit conversion shortens 64-bit value into a 32-bit value
bdb.c:1831: warning: implicit conversion shortens 64-bit value into a 32-bit value
bdb.c: In function ‘env_txn_stat’:
bdb.c:2299: warning: comparison between signed and unsigned
bdb.c: In function ‘env_repmgr_set_local_site’:
bdb.c:3005: error: ‘DB_ENV’ has no member named ‘repmgr_set_local_site’
bdb.c: In function ‘env_repmgr_add_remote_site’:
bdb.c:3024: error: ‘DB_ENV’ has no member named ‘repmgr_add_remote_site’
bdb.c:3331:1: warning: "eDbE_create" redefined
bdb.c:84:1: warning: this is the location of the previous definition
bdb.c:3424:1: warning: "ENV_LOG_CONFIG_FUNC" redefined
bdb.c:2533:1: warning: this is the location of the previous definition
make: *** [bdb.o] Error 1

【问题讨论】:

  • 你在运行 Lion 吗?你安装了哪个版本的xcode? 4.2 中的更改导致许多构建失败。
  • 我在雪豹上。 XCode 版本 3.2.6。

标签: ruby-on-rails ruby macos gem


【解决方案1】:

你看到bdb页面上的说明了吗?

作为宝石

目前该库在 RubyForge 上不可用。安装 将其作为宝石,请执行以下操作:

[sudo] gem 安装 bdb

对于从 MacPorts 安装的 Berkeley DB v4.7,请执行 以下:

[sudo] env ARCHFLAGS="-arch i386" gem install bdb 这假设你是 在 OS X 和 BerkeleyDB 上没有编译为通用二进制文件。

看来您需要通过 macports/brew 安装 berkeley db 才能安装 Gem。

【讨论】:

  • sudo port install db44 然后gem install bdb 仍然得到同样的错误。
  • 是否指定了 archflags 设置?
  • 清理了整个系统。升级了所有过时的mac端口。跑sudo port install db48。跑sudo env ARCHFLAGS="-arch i386" gem install bdb,它没有错误地完成。感谢您的帮助!
  • 如果您使用的是 brew install : berekely-db
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-06-27
  • 1970-01-01
  • 1970-01-01
  • 2020-02-09
  • 1970-01-01
  • 2014-09-18
  • 2020-07-21
相关资源
最近更新 更多