JetBrains / ruby-type-inference

Dynamic definitions and types provider for ruby static analysis
Apache License 2.0
137 stars 7 forks source link

arg_scanner build failure #18

Open develop7 opened 6 years ago

develop7 commented 6 years ago

Repro:

  1. Install rvm & MRI 2.5
  2. run gem i arg_scanner

Expected: the gem gets installed successfully Instead: gem fails to install.

Console output:

develop7@t-rex ~>  rvm use ruby-2.5.0
Using /home/develop7/.rvm/gems/ruby-2.5.0
develop7@t-rex ~>  gem i arg_scanner
Building native extensions. This could take a while...
ERROR:  Error installing arg_scanner:
    ERROR: Failed to build gem native extension.

    current directory: /home/develop7/.rvm/gems/ruby-2.5.0/gems/arg_scanner-0.2.0/ext/arg_scanner
/home/develop7/.rvm/rubies/ruby-2.5.0/bin/ruby -r ./siteconf20180320-4785-1g5uy94.rb extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for version.h... yes
checking for vm_core.h... yes
checking for vm_insnhelper.h... yes
checking for vm_core.h... yes
checking for method.h... yes
creating Makefile

current directory: /home/develop7/.rvm/gems/ruby-2.5.0/gems/arg_scanner-0.2.0/ext/arg_scanner
make "DESTDIR=" clean

current directory: /home/develop7/.rvm/gems/ruby-2.5.0/gems/arg_scanner-0.2.0/ext/arg_scanner
make "DESTDIR="
compiling arg_scanner.c
arg_scanner.c: In function ‘my_rb_vm_get_binding_creatable_next_cfp’:
arg_scanner.c:94:52: warning: passing argument 1 of ‘RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P’ from incompatible pointer type [-Wincompatible-pointer-types]
     while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) {
                                                    ^~
In file included from arg_scanner.h:5:0,
                 from arg_scanner.c:1:
/home/develop7/.rvm/gems/ruby-2.5.0/gems/debase-ruby_core_source-0.10.2/lib/debase/ruby_core_source/ruby-2.5.0-p0/vm_core.h:1244:1: note: expected ‘const rb_execution_context_t * {aka const struct rb_execution_context_struct *}’ but argument is of type ‘const rb_thread_t * {aka const struct rb_thread_struct *}’
 RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arg_scanner.c: In function ‘handle_return’:
arg_scanner.c:171:56: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘ssize_t {aka long int}’ [-Wformat=]
         "{\"method_name\":\"%s\",\"call_info_argc\":\"%d\",\"call_info_kw_args\":\"%s\",\"args_info\":\"%s\",\"visibility\":\"%s\",\"path\":\"%s\",\"lineno\":\"%d\",",
                                                       ~^
                                                       %ld
arg_scanner.c:173:9:
         sign->call_info_argc,
         ~~~~~~~~~~~~~~~~~~~~                            
arg_scanner.c: In function ‘get_call_info’:
arg_scanner.c:12:63: error: ‘thread->ec’ is a pointer; did you mean to use ‘->’?
     #define TH_CFP(thread) ((rb_control_frame_t *)(thread)->ec.cfp)
                                                               ^
arg_scanner.c:195:11: note: in expansion of macro ‘TH_CFP’
     cfp = TH_CFP(thread);
           ^~~~~~
arg_scanner.c:213:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
         const rb_iseq_t *iseq = cfp->iseq;
         ^~~~~
arg_scanner.c:232:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
                 struct rb_call_info *ci = (struct rb_call_info *)iseq_original[pc - indent + 1];
                 ^~~~~~
arg_scanner.c: In function ‘fast_join’:
arg_scanner.c:364:40: warning: passing argument 3 of ‘fast_join_array’ from incompatible pointer type [-Wincompatible-pointer-types]
     return fast_join_array(sep, count, strings);
                                        ^~~~~~~
arg_scanner.c:310:1: note: expected ‘const char **’ but argument is of type ‘char **’
 fast_join_array(char sep, size_t count, const char **strings)
 ^~~~~~~~~~~~~~~
arg_scanner.c: In function ‘get_args_info’:
arg_scanner.c:12:63: error: ‘thread->ec’ is a pointer; did you mean to use ‘->’?
     #define TH_CFP(thread) ((rb_control_frame_t *)(thread)->ec.cfp)
                                                               ^
arg_scanner.c:374:11: note: in expansion of macro ‘TH_CFP’
     cfp = TH_CFP(thread);
           ^~~~~~
arg_scanner.c:378:17: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     VALUE *ep = cfp->ep;
                 ^~~
arg_scanner.c:378:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     VALUE *ep = cfp->ep;
     ^~~~~
arg_scanner.c:381:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t param_size = cfp->iseq->body->param.size;
     ^~~~~~
arg_scanner.c:404:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     const char **types = (const char **)malloc(param_size * sizeof(const char*));
     ^~~~~
arg_scanner.c:410:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     int new_version_flag = strcmp(RUBY_VERSION, "2.4.0") >= 0 ? 1 : 0;
     ^~~
arg_scanner.c:425:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     char **ans = (char** )malloc(param_size * sizeof(char*));
     ^~~~
arg_scanner.c:444:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
         type = types[types_iterator];
              ^
arg_scanner.c:484:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
         char* type;
         ^~~~
arg_scanner.c:486:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
         type = types[types_iterator];
              ^
arg_scanner.c:497:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     int answer_size = 0;
     ^~~
arg_scanner.c:507:55: warning: passing argument 3 of ‘fast_join_array’ from incompatible pointer type [-Wincompatible-pointer-types]
     char *answer = fast_join_array(';', ans_iterator, ans);
                                                       ^~~
arg_scanner.c:310:1: note: expected ‘const char **’ but argument is of type ‘char **’
 fast_join_array(char sep, size_t count, const char **strings)
 ^~~~~~~~~~~~~~~
arg_scanner.c:507:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     char *answer = fast_join_array(';', ans_iterator, ans);
     ^~~~
arg_scanner.c: In function ‘is_call_info_needed’:
arg_scanner.c:12:63: error: ‘thread->ec’ is a pointer; did you mean to use ‘->’?
     #define TH_CFP(thread) ((rb_control_frame_t *)(thread)->ec.cfp)
                                                               ^
arg_scanner.c:559:11: note: in expansion of macro ‘TH_CFP’
     cfp = TH_CFP(thread);
           ^~~~~~
In file included from arg_scanner.h:8:0,
                 from arg_scanner.c:1:
arg_scanner.c: At top level:
/home/develop7/.rvm/gems/ruby-2.5.0/gems/debase-ruby_core_source-0.10.2/lib/debase/ruby_core_source/ruby-2.5.0-p0/vm_insnhelper.h:195:14: warning: ‘make_no_method_exception’ declared ‘static’ but never defined [-Wunused-function]
 static VALUE make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
              ^~~~~~~~~~~~~~~~~~~~~~~~
arg_scanner.c:67:13: warning: ‘signature_t_free’ defined but not used [-Wunused-function]
 static void signature_t_free(void *s)
             ^~~~~~~~~~~~~~~~
arg_scanner.c:60:13: warning: ‘call_info_t_free’ defined but not used [-Wunused-function]
 static void call_info_t_free(void *s)
             ^~~~~~~~~~~~~~~~
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
make: *** [Makefile:242: arg_scanner.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/develop7/.rvm/gems/ruby-2.5.0/gems/arg_scanner-0.2.0 for inspection.
Results logged to /home/develop7/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/arg_scanner-0.2.0/gem_make.out

environment:

develop7@t-rex ~ [1]>  gcc --version
gcc (SUSE Linux) 7.3.1 20180307 [gcc-7-branch revision 258314]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

develop7@t-rex ~>  lsb-release -sa
n/a openSUSE "openSUSE Tumbleweed" 20180316 n/a
develop7 commented 6 years ago

Right, seems to work for 2.4.3