clear-code / statistics

Statistics of ClearCode Inc. activity
Other
0 stars 2 forks source link

NMatrix: masterのRubyだとビルドが失敗するっぽい…? #148

Closed kou closed 6 years ago

kou commented 6 years ago

https://github.com/SciRuby/nmatrix

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

    current directory: /tmp/local/lib/ruby/gems/2.6.0/gems/nmatrix-0.2.4/ext/nmatrix
/tmp/local/bin/ruby -r ./siteconf20180328-7282-ymj9q7.rb extconf.rb
using C++ standard... c++11
g++ reports version... 7.3.0-12)
checking for rb_array_const_ptr() in ruby.h... yes
creating nmatrix_config.h
creating Makefile

current directory: /tmp/local/lib/ruby/gems/2.6.0/gems/nmatrix-0.2.4/ext/nmatrix
make "DESTDIR=" clean

current directory: /tmp/local/lib/ruby/gems/2.6.0/gems/nmatrix-0.2.4/ext/nmatrix
make "DESTDIR="
compiling nmatrix.cpp
cc1plus: warning: command line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
In file included from nmatrix.cpp:45:0:
math/math.h: In function ‘I nm::math::smmp_sort::median(I, I, I)’:
math/math.h:341:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if (a < c) return c; // a c b
       ^~
math/math.h:342:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
                  return a; // c a b
                  ^~~~~~
math/math.h:346:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if (b < c) return c; // b c a
       ^~
math/math.h:347:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
                  return b; // c b a
                  ^~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
ruby_nmatrix.c: In function ‘VALUE nm_init_new_version(int, VALUE*, VALUE)’:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1245:25: note: in expansion of macro ‘NM_ALLOCA_N’
     VALUE* slice_argv = NM_ALLOCA_N(VALUE, dim);
                         ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1245:25: note: in expansion of macro ‘NM_ALLOCA_N’
     VALUE* slice_argv = NM_ALLOCA_N(VALUE, dim);
                         ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1245:25: note: in expansion of macro ‘NM_ALLOCA_N’
     VALUE* slice_argv = NM_ALLOCA_N(VALUE, dim);
                         ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1255:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1256:22: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->lengths = NM_ALLOCA_N(size_t, dim);
                      ^~~~~~~~~~~
ruby_nmatrix.c: In function ‘VALUE nm_cast(VALUE, VALUE, VALUE, VALUE)’:
ruby_nmatrix.c:1511:32: error: expected primary-expression before ‘char’
   void* init_ptr = NM_ALLOCA_N(char, DTYPE_SIZES[new_dtype]);
                                ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:22: note: in definition of macro ‘ALLOCA_N’
         RUBY_ALIGNOF(type) * CHAR_BIT)
                      ^~~~
ruby_nmatrix.c:1511:20: note: in expansion of macro ‘NM_ALLOCA_N’
   void* init_ptr = NM_ALLOCA_N(char, DTYPE_SIZES[new_dtype]);
                    ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1511:20: note: in expansion of macro ‘NM_ALLOCA_N’
   void* init_ptr = NM_ALLOCA_N(char, DTYPE_SIZES[new_dtype]);
                    ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:1511:20: note: in expansion of macro ‘NM_ALLOCA_N’
   void* init_ptr = NM_ALLOCA_N(char, DTYPE_SIZES[new_dtype]);
                    ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
ruby_nmatrix.c: In function ‘VALUE nm_mset(int, VALUE*, VALUE)’:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2014:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2014:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2014:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2015:22: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->lengths = NM_ALLOCA_N(size_t, dim);
                      ^~~~~~~~~~~
ruby_nmatrix.c: In function ‘VALUE nm_shape(VALUE)’:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2132:18: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* shape = NM_ALLOCA_N(VALUE, s->dim);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2132:18: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* shape = NM_ALLOCA_N(VALUE, s->dim);
                  ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2132:18: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* shape = NM_ALLOCA_N(VALUE, s->dim);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
ruby_nmatrix.c: In function ‘VALUE nm_offset(VALUE)’:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2154:19: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* offset = NM_ALLOCA_N(VALUE, s->dim);
                   ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2154:19: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* offset = NM_ALLOCA_N(VALUE, s->dim);
                   ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2154:19: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* offset = NM_ALLOCA_N(VALUE, s->dim);
                   ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
ruby_nmatrix.c: In function ‘VALUE nm_supershape(VALUE)’:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2181:18: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* shape = NM_ALLOCA_N(VALUE, s->dim);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2181:18: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* shape = NM_ALLOCA_N(VALUE, s->dim);
                  ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2181:18: note: in expansion of macro ‘NM_ALLOCA_N’
   VALUE* shape = NM_ALLOCA_N(VALUE, s->dim);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
ruby_nmatrix.c: In function ‘VALUE nm_xslice(int, VALUE*, void* (*)(const STORAGE*, SLICE*), void (*)(NMATRIX*), VALUE)’:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2258:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2258:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2258:21: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->coords = NM_ALLOCA_N(size_t, dim);
                     ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2259:22: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->lengths = NM_ALLOCA_N(size_t, dim);
                      ^~~~~~~~~~~
ruby_nmatrix.c: In function ‘VALUE nm_inverse_exact(VALUE, VALUE, VALUE, VALUE)’:
ruby_nmatrix.c:2965:30: error: expected primary-expression before ‘char’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                              ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:22: note: in definition of macro ‘ALLOCA_N’
         RUBY_ALIGNOF(type) * CHAR_BIT)
                      ^~~~
ruby_nmatrix.c:2965:18: note: in expansion of macro ‘NM_ALLOCA_N’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2965:18: note: in expansion of macro ‘NM_ALLOCA_N’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                  ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:2965:18: note: in expansion of macro ‘NM_ALLOCA_N’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby.h:33:0,
                 from nmatrix.cpp:34:
ruby_nmatrix.c: In function ‘VALUE nm_det_exact(VALUE)’:
ruby_nmatrix.c:3009:30: error: expected primary-expression before ‘char’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                              ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:22: note: in definition of macro ‘ALLOCA_N’
         RUBY_ALIGNOF(type) * CHAR_BIT)
                      ^~~~
ruby_nmatrix.c:3009:18: note: in expansion of macro ‘NM_ALLOCA_N’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                  ^~~~~~~~~~~
In file included from /tmp/local/include/ruby-2.6.0/ruby/ruby.h:24:0,
                 from /tmp/local/include/ruby-2.6.0/ruby.h:33,
                 from nmatrix.cpp:34:
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: error: ‘_Alignof’ was not declared in this scope
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:3009:18: note: in expansion of macro ‘NM_ALLOCA_N’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                  ^~~~~~~~~~~
/tmp/local/include/ruby-2.6.0/x86_64-linux/ruby/config.h:134:22: note: suggested alternative: ‘__lrintf’
 #define RUBY_ALIGNOF _Alignof
                      ^
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:9: note: in expansion of macro ‘RUBY_ALIGNOF’
         RUBY_ALIGNOF(type) * CHAR_BIT)
         ^~~~~~~~~~~~
./nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
ruby_nmatrix.c:3009:18: note: in expansion of macro ‘NM_ALLOCA_N’
   void* result = NM_ALLOCA_N(char, DTYPE_SIZES[dtype]);
                  ^~~~~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-self-assign’
cc1plus: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1plus: warning: unrecognized command line option ‘-Wno-parentheses-equality’
make: *** [Makefile:250: nmatrix.o] エラー 1

make failed, exit code 2

Gem files will remain installed in /tmp/local/lib/ruby/gems/2.6.0/gems/nmatrix-0.2.4 for inspection.
Results logged to /tmp/local/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/nmatrix-0.2.4/gem_make.out
okkez commented 6 years ago

Ruby 2.6.0-preview1 で再現した。

okkez commented 6 years ago

↓のマクロ定義の分岐が #define RUBY_ALIGNOF alignof に行くはずなのに #define RUBY_ALIGNOF _Alignof に行ってしまっているっぽい。 C++ のソースがCのソースとして処理されてしまっている様子。

#ifdef RUBY_ALIGNOF
/* OK, take that definition */
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
#define RUBY_ALIGNOF alignof
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define RUBY_ALIGNOF _Alignof
#else
#define RUBY_ALIGNOF(type) ((size_t)offsetof(struct { char f1; type f2; }, f2))
#endif
okkez commented 6 years ago
gcc -I $HOME/.rbenv/versions/2.6.0-preview1/include/ruby-2.6.0/ -I$HOME/.rbenv/versions/2.6.0-preview1/include/ruby-2.6.0/x86_64-linux/ -I. -dM -E -x c++ -std=c++11 nmatrix.cpp | sort | lv

でマクロを展開してみると、以下のようになっていた。

#define RUBY_ALIGNOF _Alignof
#define __cplusplus 201103L
okkez commented 6 years ago

Rubyのバージョンを変えるとビルドできるのでRubyの方で質問してみた。

https://bugs.ruby-lang.org/issues/14668