title: Error Installing BDB on Ubuntu 15.04 (64 Bit), "Gem::Ext::BuildError: ERROR: Failed to build gem native extension."
body: <p>OS: Ubuntu 15.04 (64 Bit)</p>
  
  <p>Ruby Version: ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]</p>
  
  <p>While running gem install bdb, i get the following error, can anyone point out the possible cause of the error, or provide pointers towards resolution?</p>
  
  <pre><code>Error installing bdb:
  Error: Failed to build gem native extension
  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  
  /usr/share/rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20151216-2783-1lobclo.rb extconf.rb
  checking for db_version() in -ldb-5.1... no
  checking for db_version() in -ldb-5.0... no
  checking for db_version() in -ldb-4.9... no
  checking for db_version() in -ldb-4.8... no
  checking for db_version() in -ldb-4.7... no
  checking for db_version() in -ldb-4.6... no
  checking for db_version() in -ldb-4.5... no
  checking for db_version() in -ldb-4.4... no
  checking for db_version() in -ldb-4.3... no
  checking for db_version() in -ldb-4.2... no
  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 501 defines
  creating Makefile
  
  make  clean
  
  make
  compiling bdb.c
  bdb.c: In function ‘raise_error’:
  bdb.c:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    VALUE cl;
    ^
  bdb.c:84:0: warning: "eDbE_create" redefined
   #define eDbE_create(n,c) case DB_##n: cl = eDbE_##c; break;
   ^
  bdb.c:50:0: note: this is the location of the previous definition
   #define eDbE_create(n,c) VALUE eDbE_##c;
   ^
  bdb.c: In function ‘db_open’:
  bdb.c:266:9: warning: implicit declaration of function ‘raise’ [-Wimplicit-function-declaration]
           raise(0, "txn is closed");
           ^
  bdb.c: In function ‘db_get_re_len’:
  bdb.c:330:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    int rv = dbh-&gt;db-&gt;get_re_len(dbh-&gt;db,&amp;re_len);
    ^
  bdb.c: In function ‘db_set_encrypt’:
  bdb.c:1074:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
       u_int32_t flags=0x00000001; //DB_ENCRYPT_AES
       ^
  In file included from /usr/share/rvm/rubies/ruby-1.9.3-p551/include/ruby-1.9.1/ruby.h:32:0,
                   from ./bdb.h:5,
                   from bdb.c:8:
  bdb.c: In function ‘assoc_rescue’:
  /usr/share/rvm/rubies/ruby-1.9.3-p551/include/ruby-1.9.1/ruby/ruby.h:909:30: warning: format not a string literal and no format arguments [-Wformat-security]
   #define RSTRING(obj) (R_CAST(RString)(obj))
                                ^
  /usr/share/rvm/rubies/ruby-1.9.3-p551/include/ruby-1.9.1/ruby/ruby.h:903:30: note: in definition of macro ‘R_CAST’
   #define R_CAST(st)   (struct st*)
                                ^
  /usr/share/rvm/rubies/ruby-1.9.3-p551/include/ruby-1.9.1/ruby/ruby.h:679:6: note: in expansion of macro ‘RSTRING’
        RSTRING(str)-&gt;as.heap.ptr)
        ^
  bdb.c:1200:11: note: in expansion of macro ‘RSTRING_PTR’
     rb_warn(RSTRING_PTR(message));
             ^
  bdb.c: In function ‘assoc_callback’:
  bdb.c:1248:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i=0; i&lt;skey-&gt;size; i++) {
                    ^
  bdb.c:1249:30: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
           assoc_key(skey-&gt;data + i * sizeof(DBT), (VALUE)RARRAY_PTR(keys)[i]);
                                ^
  bdb.c: In function ‘db_stat’:
  bdb.c:2141:3: warning: enumeration value ‘DB_HEAP’ not handled in switch [-Wswitch]
     switch(dbtype) {
     ^
  bdb.c: In function ‘env_txn_stat’:
  bdb.c:2299:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i=0; i&lt;statp-&gt;st_nactive; i++) {
                ^
  bdb.c: In function ‘env_get_data_dirs’:
  bdb.c:2751:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    VALUE rb_data_dirs = rb_ary_new2(ln);
    ^
  bdb.c: In function ‘env_set_encrypt’:
  bdb.c:2912:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     u_int32_t flags=0x00000001; //DB_ENCRYPT_AES
     ^
  bdb.c: In function ‘env_repmgr_set_local_site’:
  bdb.c:3005:15: error: ‘DB_ENV’ has no member named ‘repmgr_set_local_site’
     rv = eh-&gt;env-&gt;repmgr_set_local_site(eh-&gt;env, StringValuePtr(host), NUM2UINT(port), 0);
                 ^
  bdb.c: In function ‘env_repmgr_add_remote_site’:
  bdb.c:3024:15: error: ‘DB_ENV’ has no member named ‘repmgr_add_remote_site’
     rv = eh-&gt;env-&gt;repmgr_add_remote_site(eh-&gt;env, StringValuePtr(host), NUM2UINT(port), &amp;eidp, 0);
                 ^
  bdb.c: In function ‘env_get_lg_bsize’:
  bdb.c:3119:3: warning: implicit declaration of function ‘UINT2FIX’ [-Wimplicit-function-declaration]
     return UINT2FIX(size);
     ^
  bdb.c: In function ‘Init_bdb’:
  bdb.c:3331:0: warning: "eDbE_create" redefined
   #define eDbE_create(n,c) eDbE_##c = rb_define_class_under(mBdb, #c, eDbError);
   ^
  bdb.c:84:0: note: this is the location of the previous definition
   #define eDbE_create(n,c) case DB_##n: cl = eDbE_##c; break;
   ^
  bdb.c:3424:0: warning: "ENV_LOG_CONFIG_FUNC" redefined
   #define ENV_LOG_CONFIG_FUNC(name,cnst) \
   ^
  bdb.c:2533:0: note: this is the location of the previous definition
   #define ENV_LOG_CONFIG_FUNC( name, cnst) \
   ^
  Makefile:206: recipe for target 'bdb.o' failed
  make: *** [bdb.o] Error 1
  
  make failed, exit code 2
  </code></pre>