Open
Description
I was having this issue when I tried testing my gem on Ruby 2.3 and greater. The gem adds the nmatrix.h
header to the native include path so that NMatrix objects can be created directly from C code. There is no problem with running NMatrix outside on a terminal or ruby scripts, it's just a macro clash that occurs when SpiceRub
is building
In file included from ../../../../ext/spice_rub/spice_ephemerides.h:5:0,
from ../../../../ext/spice_rub/spice_ephemerides.c:1:
/home/gaurav/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nmatrix-0.2.1/nmatrix.h:72:1: error: redefinition of ‘rb_array_const_ptr’
rb_array_const_ptr(VALUE a)
^
In file included from /home/gaurav/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby.h:33:0,
from ../../../../ext/spice_rub/spice_ephemerides.h:1,
from ../../../../ext/spice_rub/spice_ephemerides.c:1:
/home/gaurav/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/ruby.h:2018:1: note: previous definition of ‘rb_array_const_ptr’ was here
rb_array_const_ptr(VALUE a)
^
make: *** [spice_ephemerides.o] Error 1
rake aborted!
This is the code from extconf.rb
that locates the nmatrix header :-
nmatrix_path = Gem::Specification.find_all_by_name("nmatrix")
nmatrix_header_dir = nmatrix_path.compact[0].require_path
HEADER_DIRS = [File.expand_path(File.join(File.dirname(__FILE__), "cspice/include")), nmatrix_header_dir]