Project

General

Profile

Bug #14668

Ruby2.6.0-preview1とtrunkでnmatrixがコンパイルできない

Added by okkez (okkez _) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-dev:50520]

Description

https://github.com/SciRuby/nmatrix

Ruby2.5.1 まではコンパイルできたのですが、Ruby2.6.0-preview1 および trunk(r63103) でコンパイルできませんでした。

trunk を使ってビルドしたときのログです。

$ cd nmatrix
$ bundle exec rake compile:nmatrix
cd tmp/x86_64-linux/nmatrix/2.6.0
/tmp/local/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb
using C++ standard... c++11
g++ reports version... 7.3.0-14)
checking for rb_array_const_ptr() in ruby.h... yes
creating nmatrix_config.h
creating Makefile
cd -
cd tmp/x86_64-linux/nmatrix/2.6.0
/usr/bin/make
compiling ../../../../ext/nmatrix/nmatrix.cpp
cc1plus: warning: command line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
In file included from ../../../../ext/nmatrix/nmatrix.cpp:46:0:
../../../../ext/nmatrix/math/math.h: In function ‘I nm::math::smmp_sort::median(I, I, I)’:
../../../../ext/nmatrix/math/math.h:341:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if (a < c) return c; // a c b
       ^~
../../../../ext/nmatrix/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
                  ^~~~~~
../../../../ext/nmatrix/math/math.h:346:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if (b < c) return c; // b c a
       ^~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/ruby_nmatrix.c:1256:22: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->lengths = NM_ALLOCA_N(size_t, dim);
                      ^~~~~~~~~~~
../../../../ext/nmatrix/ruby_nmatrix.c: In function ‘VALUE nm_cast(VALUE, VALUE, VALUE, VALUE)’:
../../../../ext/nmatrix/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)
                      ^~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/ruby_nmatrix.c:2015:22: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->lengths = NM_ALLOCA_N(size_t, dim);
                      ^~~~~~~~~~~
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
../../../../ext/nmatrix/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)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/tmp/local/include/ruby-2.6.0/ruby/ruby.h:1613:26: error: expected primary-expression before ‘)’ token
         RUBY_ALIGNOF(type) * CHAR_BIT)
                          ^
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/ruby_nmatrix.c:2259:22: note: in expansion of macro ‘NM_ALLOCA_N’
     slice->lengths = NM_ALLOCA_N(size_t, dim);
                      ^~~~~~~~~~~
../../../../ext/nmatrix/ruby_nmatrix.c: In function ‘VALUE nm_inverse_exact(VALUE, VALUE, VALUE, VALUE)’:
../../../../ext/nmatrix/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)
                      ^~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
../../../../ext/nmatrix/ruby_nmatrix.c: In function ‘VALUE nm_det_exact(VALUE)’:
../../../../ext/nmatrix/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)
                      ^~~~
../../../../ext/nmatrix/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 ../../../../ext/nmatrix/nmatrix.cpp:35:
/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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)
         ^~~~~~~~~~~~
../../../../ext/nmatrix/nm_memory.h:44:31: note: in expansion of macro ‘ALLOCA_N’
 #define NM_ALLOCA_N(type, n) (ALLOCA_N(type, n))
                               ^~~~~~~~
../../../../ext/nmatrix/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
rake aborted!
Command failed with status (2): [/usr/bin/make...]
/tmp/local/bin/bundle:23:in `load'
/tmp/local/bin/bundle:23:in `<main>'
Tasks: TOP => compile:nmatrix => compile:nmatrix:x86_64-linux => copy:nmatrix:x86_64-linux:2.6.0 => tmp/x86_64-linux/nmatrix/2.6.0/nmatrix.so
(See full trace by running task with --trace)

これは nmatrix 側で何か対応が必要でしょうか?対応が必要であれば、どのような変更をすればよいのか教えてもらえないでしょうか?

Updated by wanabe (_ wanabe) over 2 years ago

r61843 以降、ALLOCA_N マクロの中で(利用可能なときには) RUBY_ALIGNOF マクロを利用するようになったことがきっかけのようです。

ただこれはきっかけというだけで、どちらかというと RUBY_ALIGNOF マクロが config.h の中に _Alignof の形で定義されていて、nmatrix のように C++ のプログラム中で用いる場合にも alignof にはなってくれないことの方がより根本的な原因のように見えます。

#2

Updated by shyouhei (Shyouhei Urabe) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63123.


Prefer alignof() over _Alignof()

to allow C++ programs include . [Bug #14668]

Updated by shyouhei (Shyouhei Urabe) over 2 years ago

とりあえずstdalign.hをincludeするようにしてalignofを優先したのでtrunkご確認ください。

余談ですがC++の場合、allocaを使う必然性は皆無のはずです。普通に VALUE slice_argv[dim]; とかでいいはず。CもC99以降はそうです。Rubyがいまだにalloca使ってるのは古いCに固執してるから、という認識でいます。

Updated by okkez (okkez _) over 2 years ago

trunk で試したところコンパイルが通るようになりました。
ありがとうございます!

余談も https://github.com/SciRuby/nmatrix に共有しておきます。

Also available in: Atom PDF