Project

General

Profile

Bug #14751

error during transform_mjit_header.rb on Solaris 10

Added by ngoto (Naohisa Goto) about 1 year ago. Updated about 1 year ago.

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

Description

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

Associated revisions

Revision 1c67c46e
Added by ngoto (Naohisa Goto) about 1 year ago

transform_mjit_header.rb: workaround for Solaris 10 with old GCC

  • tool/transform_mjit_header.rb (MJITHeader.conflicting_types?): Add workaround for Solaris 10 with old GCC (4.6.2), that is essentially the same as for AIX (commit r62326), but probably due to different GCC versions, different error message is shown. [Bug #14751] [ruby-dev:50541]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 63400
Added by ngoto (Naohisa Goto) about 1 year ago

transform_mjit_header.rb: workaround for Solaris 10 with old GCC

  • tool/transform_mjit_header.rb (MJITHeader.conflicting_types?): Add workaround for Solaris 10 with old GCC (4.6.2), that is essentially the same as for AIX (commit r62326), but probably due to different GCC versions, different error message is shown. [Bug #14751] [ruby-dev:50541]

Revision 63400
Added by ngoto (Naohisa Goto) about 1 year ago

transform_mjit_header.rb: workaround for Solaris 10 with old GCC

  • tool/transform_mjit_header.rb (MJITHeader.conflicting_types?): Add workaround for Solaris 10 with old GCC (4.6.2), that is essentially the same as for AIX (commit r62326), but probably due to different GCC versions, different error message is shown. [Bug #14751] [ruby-dev:50541]

History

#1

Updated by ngoto (Naohisa Goto) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63400.


transform_mjit_header.rb: workaround for Solaris 10 with old GCC

  • tool/transform_mjit_header.rb (MJITHeader.conflicting_types?): Add workaround for Solaris 10 with old GCC (4.6.2), that is essentially the same as for AIX (commit r62326), but probably due to different GCC versions, different error message is shown. [Bug #14751] [ruby-dev:50541]

Also available in: Atom PDF