Project

General

Profile

Actions

Bug #18808

closed

Cannot compile ruby 3.1.2 on powerpc64le-linux without disabling the jit features

Added by npn (John Davis) almost 2 years ago. Updated about 1 year ago.

Status:
Closed
Target version:
-
[ruby-core:108708]

Description

The system I am trying to compile on is a ppc64el system running RedHat 7 (3.10.0-1160.62.1.el7.ppc64le). I can successfully compile on a x86_64 system running the same version RedHat 7 (3.10.0-1160.62.1.el7.x86_64)

When I configure with the following, make completes fine, but if I remove the --disable-jit-support it fails with the following error.

 ./configure --enable-shared --enable-load-relative  --disable-install-doc --prefix=$RUBY_PREFIX --exec-prefix=$RUBY_PREFIX/rh_ppc --disable-jit-support

building rb_mjit_header.h
rb_mjit_header.h updated
building .ext/include/powerpc64le-linux/rb_mjit_min_header-3.1.2.h
error in final header file:
In file included from /tmp/20220525-12786-q2ndz2.c:1:0:
/tmp/20220525-12786-vf3xbh.h:16627:1: error: multiple storage classes in declaration specifiers
 __attribute__ ((__visibility__("default"))) extern
 ^
compilation terminated due to -Wfatal-errors.
make: *** [.ext/include/powerpc64le-linux/rb_mjit_min_header-3.1.2.h] Error 1

Files

config.log (1.45 MB) config.log michals (Michal Suchánek), 06/14/2022 05:38 AM
rb_mjit_min_header-3.2.0.h (1000 KB) rb_mjit_min_header-3.2.0.h michals (Michal Suchánek), 06/14/2022 05:57 AM
rb_mjit_header.h (1010 KB) rb_mjit_header.h michals (Michal Suchánek), 06/14/2022 04:59 PM
rb_mjit_header.h (1010 KB) rb_mjit_header.h npn (John Davis), 06/17/2022 01:21 PM
config.log (1.37 MB) config.log npn (John Davis), 06/17/2022 01:21 PM

Updated by michals (Michal Suchánek) almost 2 years ago

Also a problem on SLE 12

Deleting the extern reports the same error on the next line with __attribute__ ((__visibility__("default"))) extern which suggests that extern does not go with __attribute__ ((__visibility__("default")))

ruby: trunk
ruby 3.2.0dev (2022-06-12T17:35:26Z master 8158f05e72) [powerpc64le-linux]
./configure --prefix=/opt/ruby --disable-install-doc --with-baseruby=/opt/ruby/bin/ruby
gcc (SUSE Linux) 4.8.5

I only built ruby on this platform to diagnose a problem which happens only with an old compiler so I am fine with disabled JIT. The problem is that wrong code is generated with JIT and it is not detected by configure that JIT should be disabled.

Updated by michals (Michal Suchánek) almost 2 years ago

diff --git a/tool/transform_mjit_header.rb b/tool/transform_mjit_header.rb
index 8867c556f0..63a072573a 100644
--- a/tool/transform_mjit_header.rb
+++ b/tool/transform_mjit_header.rb
@@ -194,10 +194,10 @@ def self.conflicting_types?(code, cc, cflags)
 
   def self.with_code(code)
     # for `system_header` pragma which can't be in the main file.
-    Tempfile.open(['', '.h'], mode: File::BINARY) do |f|
+    File.open('/tmp/ruby-testheader.h', mode: File::BINARY|File::CREAT|File::RDWR|File::TRUNC) do |f|
       f.puts code
       f.close
-      Tempfile.open(['', '.c'], mode: File::BINARY) do |c|
+      File.open('/tmp/ruby-testprogram.c', mode: File::BINARY|File::CREAT|File::RDWR|File::TRUNC) do |c|
         c.puts <<SRC
 #include "#{f.path}"
 SRC

./miniruby -I./lib -I. -I.ext/common  ./tool/transform_mjit_header.rb "gcc -std=gnu99 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Werror=deprecated-declarations -Werror=div-by-zero -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-arith -Werror=write-strings -Werror=old-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable   -w" rb_mjit_header.h .ext/include/powerpc64le-linux/rb_mjit_min_header-3.2.0.h
error in final header file:
In file included from /tmp/ruby-testprogram.c:1:0:
/tmp/ruby-testheader.h:16626:1: error: multiple storage classes in declaration specifiers
 __attribute__ ((__visibility__("default"))) extern
 ^
compilation terminated due to -Wfatal-errors.
uncommon.mk:251: recipe for target '.ext/include/powerpc64le-linux/rb_mjit_min_header-3.2.0.h' failed
make: *** [.ext/include/powerpc64le-linux/rb_mjit_min_header-3.2.0.h] Error 1

Updated by mame (Yusuke Endoh) almost 2 years ago

  • Status changed from Open to Feedback

I cannot reproduce the issue with Ubuntu 20.04 on ppc64le. Could you provide config.log?

Updated by xtkoba (Tee KOBAYASHI) almost 2 years ago

If __attribute__ ((__visibility__("default"))) did not go with extern on a specific platform, then the following C code failed to compile:

__attribute__ ((__visibility__("default"))) extern
int foo(void);

FWIW, with the following C code (named ruby-bug18808.c)

static
__attribute__ ((__visibility__("default"))) extern
int foo(void);

I get (on x86_64 GNU/Linux)

$ gcc-11.3.0 -Wfatal-errors ruby-bug18808.c -c
ruby-bug18808.c:3:1: error: multiple storage classes in declaration specifiers
    3 | __attribute__ ((__visibility__("default"))) extern
      | ^~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.

because extern does not go with static. The error message from GCC does not seem to be very friendly though. I'm not saying that this is the case here but that we need more information to narrow down the problem. At least we need config.log as @mame (Yusuke Endoh) said, and preferably the whole rb_mjit_header.h to investigate the context.

Updated by michals (Michal Suchánek) almost 2 years ago

/tmp/20220614-16633-i2edux.h:16633:1: error: multiple storage classes in declaration specifiers
 __attribute__ ((__visibility__("default"))) extern
 ^
compilation terminated due to -Wfatal-errors.
_Bool
rb_simple_iseq_p(const rb_iseq_t *iseq)
{
    return ((iseq)->body)->param.flags.has_opt == 0 &&
           ((iseq)->body)->param.flags.has_rest == 0 &&
           ((iseq)->body)->param.flags.has_post == 0 &&
           ((iseq)->body)->param.flags.has_kw == 0 &&
           ((iseq)->body)->param.flags.has_kwrest == 0 &&
           ((iseq)->body)->param.flags.accepts_no_kwarg == 0 &&
           ((iseq)->body)->param.flags.has_block == 0;
}static inline 
__attribute__ ((__visibility__("default"))) extern <<< line with error
_Bool
rb_iseq_only_optparam_p(const rb_iseq_t *iseq)
{
    return ((iseq)->body)->param.flags.has_opt == 1 &&
           ((iseq)->body)->param.flags.has_rest == 0 &&
           ((iseq)->body)->param.flags.has_post == 0 &&
           ((iseq)->body)->param.flags.has_kw == 0 &&
           ((iseq)->body)->param.flags.has_kwrest == 0 &&
           ((iseq)->body)->param.flags.accepts_no_kwarg == 0 &&
           ((iseq)->body)->param.flags.has_block == 0;
}static inline 
Actions #7

Updated by mame (Yusuke Endoh) almost 2 years ago

  • Status changed from Feedback to Open

Updated by mame (Yusuke Endoh) almost 2 years ago

  • Status changed from Open to Assigned
  • Assignee set to k0kubun (Takashi Kokubun)

Updated by npn (John Davis) almost 2 years ago

Can I email these files to someone directly rather than post them here?

Updated by k0kubun (Takashi Kokubun) almost 2 years ago

You can, but then the recipient should attach the files here anyway for everybody to be able to debug the issue with them. Do you have a browser to upload them yourself?

Updated by k0kubun (Takashi Kokubun) almost 2 years ago

  • Status changed from Assigned to Feedback

Given that this is not reproduced on RubyCI, I think this report is not actionable until we see an entire rb_mjit_header.h (not rb_mjit_min_header-3.2.0.h) that reproduces this problem. I'll leave this issue until somebody uploads one.

@npn (John Davis) @michals (Michal Suchánek) Could you find rb_mjit_header.h (again, not rb_mjit_min_header-3.2.0.h) in your build directory and upload it here? Note that it's just pre-processed vm.c of CRuby, so you shouldn't have any concern about sharing it here.

Updated by michals (Michal Suchánek) almost 2 years ago

--- rb_mjit_header.h    2022-06-14 18:58:52.514742594 +0200
+++ rb_mjit_min_header-3.2.0.h  2022-06-14 07:47:37.415389264 +0200

...

@@ -22947,7 +16629,7 @@
            ((iseq)->body)->param.flags.has_kwrest == 0 &&
            ((iseq)->body)->param.flags.accepts_no_kwarg == 0 &&
            ((iseq)->body)->param.flags.has_block == 0;
-}
+}static inline 
 __attribute__ ((__visibility__("default"))) extern
 _Bool
 rb_iseq_only_optparam_p(const rb_iseq_t *iseq)
@@ -22959,7 +16641,7 @@
            ((iseq)->body)->param.flags.has_kwrest == 0 &&
            ((iseq)->body)->param.flags.accepts_no_kwarg == 0 &&
            ((iseq)->body)->param.flags.has_block == 0;
-}
+}static inline 
 __attribute__ ((__visibility__("default"))) extern
 _Bool
 rb_iseq_only_kwparam_p(const rb_iseq_t *iseq)

Updated by xtkoba (Tee KOBAYASHI) almost 2 years ago

Line 22951-22953 of rb_mjit_header.h:

__attribute__ ((__visibility__("default"))) extern
_Bool
rb_iseq_only_optparam_p(const rb_iseq_t *iseq)

Note the newline immediately following extern, which is unexpected by the current tool/transform_mjit_header.rb.

Updated by k0kubun (Takashi Kokubun) almost 2 years ago

  • Status changed from Feedback to Assigned

Thank you both. As long as we have rb_mjit_header.h, I think we can work on it. I'll work on what @michals (Michal Suchánek) provided to close this issue.

Updated by npn (John Davis) almost 2 years ago

Sorry for the delay here are copies of the requested files. I had to change some path info in the config.log since it had identifying information.
So for example /afs/some_string/ -> /afs/xyz and /opt/xsite/some_other_string/ -> /opt/xsite/abc, hopefully that will not cause any issue with the debug.

Updated by jaruga (Jun Aruga) over 1 year ago

@npn (John Davis) What is the gcc version are you using on the RHEL 7? Are you using a default system gcc maybe 4.8?

For example, in the latest Red Hat Software Collections 3.8 that you can install to RHEL 7, there is a SCL devtoolset-11 including gcc 11.2 according to the document. Why don't you use the newer version?
See https://access.redhat.com/documentation/en-us/red_hat_software_collections/3/html/3.8_release_notes/chap-rhscl.

Updated by jaruga (Jun Aruga) over 1 year ago

One more thing, the Red Hat Software Collections (RHSCL) 3.8 provides the Ruby 3.0 software collection (Ruby 3.0.2 - rh-ruby30). Possibly you can use it on RHEL 7 ppc64le.

Updated by k0kubun (Takashi Kokubun) about 1 year ago

  • Status changed from Assigned to Closed

I replaced the build process in [Feature #19420], and this issue seems irrelevant to today's build system. Closing.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0