Project

General

Profile

Bug #14446

Solaris 10 上の Oracle Developer Studio 12.5 および 12.6 の64ビットコンパイル時のmjit関係のエラー

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

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:85392]

Description

Solaris 10 上にて、Oracle Developer Studio 12.5 または 12.6 にて64ビットコンパイル時、以下のエラーでコンパイルに失敗します。

64ビットバイナリの作成には -m64 (もっと古いバージョンのコンパイラでは -xarch=v9)をCFLAGSやLDFLAGSに付ける必要があるのですが、 ./tool/transform_mjit_header.rb がそれに対応していない(CFLAGS相当が決め打ち)なのが原因のように見えます。

$ export CC=cc
$ export CXX=CC
$ export CPPLAGS="-I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include"
$ export CFLAGS="-errtags=yes  -xO4 -xtarget=sparc64xplus -m64"
$ export CXXFLAGS=$CFLAGS
$ export LDFLAGS="-m64 -L/usr/local/64/lib -R/usr/local/64/lib"
$ export DLDFLAGS=$LDFLAGS
$ export MAKE=/usr/local/64/bin/make
$ ./configure --prefix=/XXXXX/sparc64-cc126-trunk --build=sparc64-sun-solaris2.10 --with-tclConfig-dir=/usr/local/64/lib --with-tkConfig-dir=/usr/local/64/lib
(中略)
$ /usr/local/64/bin/make V=1
    BASERUBY = /usr/local/64/bin/ruby --disable=gems
    CC = cc
    LD = /usr/ccs/bin/ld
    LDSHARED = cc -G
    CFLAGS = -errtags=yes  -xO4 -xtarget=sparc64xplus -m64
    XCFLAGS = -DRUBY_DEVEL=1 -DRUBY_EXPORT
    CPPFLAGS = -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include  -D_XOPEN_SOURCE=600   -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/10.0.0 -DMJIT_HEADER_BUILD_DIR=".ext/include/sparc64-solaris2.10" -DLIBRUBYARG_SHARED="-L/XXXXX/sparc64-cc126-trunk/lib
" -DLIBRUBY_LIBDIR="/XXXXX/sparc64-cc126-trunk/lib" -DMJIT_HEADER_INSTALL_DIR="/XXXXX/sparc64-cc126-trunk/include/ruby-2.6.0/sparc64-solaris2.10"
    DLDFLAGS = -m64  -L/usr/local/64/lib -R/usr/local/64/lib  -m64
    SOLIBS = 
    LANG = C
    LC_ALL = 
    LC_CTYPE = 
cc: Studio 12.6 Sun C 5.15 SunOS_sparc 2017/05/30
cc  -errtags=yes  -xO4 -xtarget=sparc64xplus -m64 -DRUBY_DEVEL=1 -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include  -D_XOPEN_SOURCE=600   -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/10.0.0 -DMJIT_HEADER_BUILD_DIR=\"".ext/include/sparc64-solaris2.10"\" -DLIBRUBYARG_SHARED=\""-L/XXXXX/sparc64-cc126-trunk/lib "\" -DLIBRUBY_LIBDIR=\""/XXXXX/sparc64-cc126-trunk/lib"\" -DMJIT_HEADER_INSTALL_DIR=\""/XXXXX/sparc64-cc126-trunk/include/ruby-2.6.0/sparc64-solaris2.10"\" -o main.o -c ./main.c
(中略)
cc -E  -errtags=yes  -xO4 -xtarget=sparc64xplus -DRUBY_DEVEL=1 -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include  -D_XOPEN_SOURCE=600   -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/10.0.0 -DMJIT_HEADER_BUILD_DIR=\"".ext/include/sparc64-solaris2.10"\" -DLIBRUBYARG_SHARED=\""-L/user/gen-info/ngoto/testruby/daily/sparc64-cc126-trunk/lib "\" -DLIBRUBY_LIBDIR=\""/XXXXX/sparc64-cc126-trunk/lib"\" -DMJIT_HEADER_INSTALL_DIR=\""/XXXXX/sparc64-cc126-trunk/include/ruby-2.6.0/sparc64-solaris2.10"\" -DMJIT_HEADER ./vm.c -o vm.new
./tool/ifchange rb_mjit_header.h vm.new
rb_mjit_header.h updated
./miniruby -I./lib -I. -I.ext/common  ./tool/transform_mjit_header.rb "cc" rb_mjit_header.h .ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h
error in initial header file:
"include/ruby/ruby.h", line 104: zero or negative subscript
"include/ruby/ruby.h", line 108: zero or negative subscript
"./include/ruby/st.h", line 58: zero or negative subscript
"internal.h", line 252: warning: shift count negative or too big: >> 32
"internal.h", line 408: warning: shift count negative or too big: << 63
"internal.h", line 1501: warning: shift count negative or too big: >> 63
"internal.h", line 1538: warning: shift count negative or too big: >> 60
cc: acomp failed for /var/tmp/20180205-11459-t2wq56.c
make: *** [.ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h] Error 1

Associated revisions

Revision 646b24a9
Added by k0kubun (Takashi Kokubun) over 1 year ago

transform_mjit_header.rb: ignore unsupported cc

to generate MJIT header.

Even if we can't build MJIT header, Ruby's build should success. And
compilers which are not explicitly supported are likely to fail to
transform MJIT header.

Also you can pass only gcc or clang to --jit-cc=xxx for now. Thus
generating header does never make sense.

So I decided to conservatively give up MJIT header generation.
But please feel free to add your favorite compiler's macro if you think
it's working. (Another workaround is passing -D_GNUC_ :p)

[Bug #14447] [Bug #14446]

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

Revision 62285
Added by k0kubun (Takashi Kokubun) over 1 year ago

transform_mjit_header.rb: ignore unsupported cc

to generate MJIT header.

Even if we can't build MJIT header, Ruby's build should success. And
compilers which are not explicitly supported are likely to fail to
transform MJIT header.

Also you can pass only gcc or clang to --jit-cc=xxx for now. Thus
generating header does never make sense.

So I decided to conservatively give up MJIT header generation.
But please feel free to add your favorite compiler's macro if you think
it's working. (Another workaround is passing -D_GNUC_ :p)

[Bug #14447] [Bug #14446]

Revision 62285
Added by k0kubun (Takashi Kokubun) over 1 year ago

transform_mjit_header.rb: ignore unsupported cc

to generate MJIT header.

Even if we can't build MJIT header, Ruby's build should success. And
compilers which are not explicitly supported are likely to fail to
transform MJIT header.

Also you can pass only gcc or clang to --jit-cc=xxx for now. Thus
generating header does never make sense.

So I decided to conservatively give up MJIT header generation.
But please feel free to add your favorite compiler's macro if you think
it's working. (Another workaround is passing -D_GNUC_ :p)

[Bug #14447] [Bug #14446]

History

Updated by k0kubun (Takashi Kokubun) over 1 year ago

再現するリビジョンを書いていただけますか? 少なくとも https://rubyci.org/ ではr62224のビルドは通っていますが、現在のtrunk(r62230)でもビルドが失敗しますか?

Updated by ngoto (Naohisa Goto) over 1 year ago

r62224 です。書き漏らしていました、すみません。

Updated by k0kubun (Takashi Kokubun) over 1 year ago

https://github.com/ruby/ruby/blob/a3225c6eba7979822a4c1ea28581079256d5cf28/common.mk#L200 の $(CFLAGS_NO_ARCH) を $(CFLAGS) に変更した場合も再現しますか?

Updated by ngoto (Naohisa Goto) over 1 year ago

現時点の最新の r62232 にて、$(CFLAGS_NO_ARCH) を $(CFLAGS) に変更、を試しましたが、同様でした。

cc -E  -errtags=yes  -xO4 -xtarget=sparc64xplus -m64 -DRUBY_DEVEL=1 -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include  -D_XOPEN_SOURCE=600   -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/10.0.0 -DMJIT_HEADER_BUILD_DIR=\"".ext/include/sparc64-solaris2.10"\" -DLIBRUBYARG_SHARED=\""-L/XXXXX/sparc64-cc126-trunk/lib "\" -DLIBRUBY_LIBDIR=\""/XXXXX/sparc64-cc126-trunk/lib"\" -DMJIT_HEADER_INSTALL_DIR=\""/XXXXX/sparc64-cc126-trunk/include/ruby-2.6.0/sparc64-solaris2.10"\" -DMJIT_HEADER ./vm.c -o vm.new
./tool/ifchange rb_mjit_header.h vm.new
rb_mjit_header.h updated
./miniruby -I./lib -I. -I.ext/common  ./tool/transform_mjit_header.rb "cc" rb_mjit_header.h .ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h
error in initial header file:
"/var/tmp/20180205-29496-i4xsvl.c", line 3774: zero or negative subscript
"/var/tmp/20180205-29496-i4xsvl.c", line 3776: zero or negative subscript
"/var/tmp/20180205-29496-i4xsvl.c", line 4804: zero or negative subscript
"/var/tmp/20180205-29496-i4xsvl.c", line 5772: warning: shift count negative or too big: >> 32
"/var/tmp/20180205-29496-i4xsvl.c", line 5820: warning: shift count negative or too big: >> 32
"/var/tmp/20180205-29496-i4xsvl.c", line 5851: warning: shift count negative or too big: << 63
"/var/tmp/20180205-29496-i4xsvl.c", line 6569: warning: shift count negative or too big: >> 63
"/var/tmp/20180205-29496-i4xsvl.c", line 6604: warning: shift count negative or too big: >> 60
cc: acomp failed for /var/tmp/20180205-29496-i4xsvl.c
make: *** [.ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h] Error 1

Updated by k0kubun (Takashi Kokubun) over 1 year ago

https://github.com/ruby/ruby/blob/68baf9551e5d7bb43d1a7cce8e80ecb5f06e8724/tool/transform_mjit_header.rb#L130 この行を、

  cflags = '-S -DMJIT_HEADER -fsyntax-only -Werror=implicit-function-declaration -Werror=implicit-int -Wfatal-errors -errtags=yes  -xO4 -xtarget=sparc64xplus -m64'

のようにした場合 make .ext/include/sparc64-solaris2.10/rb_mjit_min_header-2.6.0.h は通りますか?

#6

Updated by k0kubun (Takashi Kokubun) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r62285.


transform_mjit_header.rb: ignore unsupported cc

to generate MJIT header.

Even if we can't build MJIT header, Ruby's build should success. And
compilers which are not explicitly supported are likely to fail to
transform MJIT header.

Also you can pass only gcc or clang to --jit-cc=xxx for now. Thus
generating header does never make sense.

So I decided to conservatively give up MJIT header generation.
But please feel free to add your favorite compiler's macro if you think
it's working. (Another workaround is passing -D_GNUC_ :p)

[Bug #14447] [Bug #14446]

Updated by ngoto (Naohisa Goto) over 1 year ago

Close済ですが追記します。

r62240 にて -m64 などの ARCH_FLAG がmjitヘッダ生成時に渡るようになり、(r62285 より前の時点で)Ruby本体のビルド自体はエラー無く正常終了するようになっていました。(r62265 にて確認)

なお、生成されたヘッダを使ったJITは残念ながら上手くいかないようでしたが詳細は未確認です。それが必要になったら別チケットを切ります。

Also available in: Atom PDF