From: ngotogenome@... Date: 2018-05-11T16:24:34+00:00 Subject: [ruby-dev:50541] [Ruby trunk Bug#14751] error during transform_mjit_header.rb on Solaris 10 Issue #14751 has been reported by ngoto (Naohisa Goto). ---------------------------------------- Bug #14751: error during transform_mjit_header.rb on Solaris 10 https://bugs.ruby-lang.org/issues/14751 * Author: ngoto (Naohisa Goto) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Solaris 10 にて、以下のエラーで transform_mjit_header.rb に失敗します。 (r63361 にて確認) ~~~ gcc -E -DMJIT_HEADER -P -dD -m64 -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Werror=implicit-int -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=deprecated-declarations -Wno-overlength-strings -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wmissing-noreturn -std=gnu99 -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include -I. -I.ext/include/sparc64-solaris2.10 -I../github/ruby/include -I../github/ruby -I../github/ruby/enc/unicode/10.0.0 ../github/ruby/vm.c -o rb_mjit_header.h.new ../github/ruby/tool/ifchange "--timestamp=.ext/.timestamp/rb_mjit_header.time" rb_mjit_header.h rb_mjit_header.h.new rb_mjit_header.h updated ./miniruby -I../github/ruby/lib -I. -I.ext/common ../github/ruby/tool/transform_mjit_header.rb "gcc " rb_mjit_header.h .ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h error in initial header file: /tmp/20180511-27294-9cawxv.c:25:54: error: redefinition of parameter 'restrict' compilation terminated due to -Wfatal-errors. make: *** [.ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h] Error 1 ~~~ /tmp/20180511-27294-9cawxv.c:25 は以下の行です。 ~~~ extern FILE *fopen(const char *restrict, const char *restrict); ~~~ C99にて追加されたキーワード restrict に対して、このバージョンのgccのデフォルトはC90なので普通の変数として取り扱った結果、同じ名前の変数をプロトタイプ宣言に使ったことになり、エラーになった模様です。 現象および対策は、r62326 のAIX用のworkaroundと全く同様ですが、おそらくgccのバージョン違いのため、異なるエラーメッセージが出ているのが、r62236 では救えなかった理由のようです。 私の手元では、gcc 4.6.2 という、かなり古いバージョンを使用しています。 以下のパッチにて解消しました。 ~~~ diff --git a/tool/transform_mjit_header.rb b/tool/transform_mjit_header.rb index f53f1252cb..f00beb45a9 100644 --- a/tool/transform_mjit_header.rb +++ b/tool/transform_mjit_header.rb @@ -166,7 +166,9 @@ def self.conflicting_types?(code, cc, cflags) with_code(code) do |path| cmd = "#{cc} #{cflags} #{path}" out = IO.popen(cmd, err: [:child, :out], &:read) - !$?.success? && out.match?(/error: conflicting types for '[^']+'/) + !$?.success? && + (out.match?(/error: conflicting types for '[^']+'/) || + out.match?(/error: redefinition of parameter '[^']+'/)) end end ~~~ -- https://bugs.ruby-lang.org/