Ruby on Rails - 安装bdb时出错。无法构建gem原生扩展

时间:2011-11-09 16:17:13

标签: ruby-on-rails ruby macos gem

运行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

1 个答案:

答案 0 :(得分:1)

您是否在bdb页面上看到了说明?

  

作为宝石

     

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

     

[sudo] gem install bdb

     

对于从MacPorts安装的Berkeley DB v4.7   以下内容:

     

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

所以看起来你需要通过macports / brew安装berkeley db来安装Gem。