isamu / rocksdb-ruby

A simple RocksDB library for Ruby
MIT License
75 stars 24 forks source link

Compilation failure with Ruby 2.3.0 #9

Closed joliss closed 8 years ago

joliss commented 8 years ago

rocksdb-ruby installs fine with Ruby 2.2.4. With Ruby 2.3.0, however, I'm getting the following error:

$ bundle install
Fetching gem metadata from https://rubygems.org/..
Fetching version metadata from https://rubygems.org/.
Installing rocksdb-ruby 0.1.2 with native extensions

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

    current directory: /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rocksdb-ruby-0.1.2/ext/rocksdb
/home/ubuntu/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160201-84189-1j74nfh.rb extconf.rb
checking for rocksdb/db.h... yes
checking for main() in -lrocksdb... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/rocksdb-ruby-0.1.2/mkmf.log

current directory: /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rocksdb-ruby-0.1.2/ext/rocksdb
make "DESTDIR=" clean

current directory: /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rocksdb-ruby-0.1.2/ext/rocksdb
make "DESTDIR="
compiling rocksdb_batch_rb.cc
compiling rocksdb_db_rb.cc
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby.h:33:0,
                 from rocksdb_rb.h:10,
                 from rocksdb_db_rb.cc:1:
rocksdb_db_rb.cc: In function ‘VALUE rocksdb_db_multi_get(VALUE, VALUE)’:
/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:882:52: error: ‘__builtin_choose_expr’ was not declared in this scope
      OBJ_WB_UNPROTECT((VALUE)(obj)), ((VALUE)(obj))))
                                                    ^
/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:1039:48: note: in definition of macro ‘RARRAY_CONST_PTR’
 #define RARRAY_CONST_PTR(a) rb_array_const_ptr(a)
                                                ^
/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:1059:50: note: in expansion of macro ‘RB_OBJ_WB_UNPROTECT_FOR’
 #define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(ARRAY, a)))
                                                  ^
rocksdb_db_rb.cc:122:18: note: in expansion of macro ‘RARRAY_PTR’
     VALUE *tmp = RARRAY_PTR(v_array);
                  ^
make: *** [rocksdb_db_rb.o] Error 1
make: *** Waiting for unfinished jobs....

make failed, exit code 2

Gem files will remain installed in /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rocksdb-ruby-0.1.2 for inspection.
Results logged to /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/rocksdb-ruby-0.1.2/gem_make.out
Using bundler 1.11.2
An error occurred while installing rocksdb-ruby (0.1.2), and Bundler cannot continue.
Make sure that `gem install rocksdb-ruby -v '0.1.2'` succeeds before bundling.

Here is the mkmf.log it references (not sure if helpful):

$ cat /home/ubuntu/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/rocksdb-ruby-0.1.2/mkmf.log
have_header: checking for rocksdb/db.h... -------------------- yes

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0 -I. -I/home/ubuntu/.rbenv/versions/2.3.0/include    -g -Wall  conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.3.0/lib -Wl,-R/home/ubuntu/.rbenv/versions/2.3.0/lib -L. -L/home/ubuntu/.rbenv/versions/2.3.0/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/home/ubuntu/.rbenv/versions/2.3.0/lib -L/home/ubuntu/.rbenv/versions/2.3.0/lib -lruby-static  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"g++ -E -std=gnu++11 -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0 -I. -I/home/ubuntu/.rbenv/versions/2.3.0/include    -g -Wall   conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <rocksdb/db.h>
/* end */

--------------------

have_library: checking for main() in -lrocksdb... -------------------- yes

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.3.0/include/ruby-2.3.0 -I. -I/home/ubuntu/.rbenv/versions/2.3.0/include    -g -Wall  conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.3.0/lib -Wl,-R/home/ubuntu/.rbenv/versions/2.3.0/lib -L. -L/home/ubuntu/.rbenv/versions/2.3.0/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/home/ubuntu/.rbenv/versions/2.3.0/lib -L/home/ubuntu/.rbenv/versions/2.3.0/lib -lruby-static -lrocksdb  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10:
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return !p; }
/* end */

--------------------

This is with rocksdb master (https://github.com/facebook/rocksdb/commit/1d854fa3d46cc8da984b5f70ec7856917bb52e70). Let me know if there's anything else I can do to help debug this!

isamu commented 8 years ago

Build error was fixed. RARRAY_PTR is no longer supported ruby 2.3.0.