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` does not build via RubyGems, but builds locally (ruby 2.6.3) #38

Closed kigster closed 4 years ago

kigster commented 5 years ago

Environment

Glib Info

❯ brew info glib
glib: stable 2.60.4 (bottled)
Core application library for C
https://developer.gnome.org/glib/
/usr/local/Cellar/glib/2.60.4_1 (429 files, 15.2MB) *
  Poured from bottle on 2019-07-08 at 12:16:33
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/glib.rb
==> Dependencies
Build: meson ✘, ninja ✘, pkg-config ✔
Required: gettext ✔, libffi ✔, pcre ✔, python ✔
==> Analytics
install: 269,742 (30 days), 806,009 (90 days), 2,230,191 (365 days)
install_on_request: 14,128 (30 days), 39,723 (90 days), 100,768 (365 days)
build_error: 0 (30 days)

Problem(s)

There were several issues building this gem. Please note that I have successfully installed glib via brew.

  1. When installing via gem install arg_scanner, the gem fails to install with the following output:

      ❯ gem install arg_scanner 
      Building native extensions. This could take a while...
      ERROR:  Error installing arg_scanner:
        ERROR: Failed to build gem native extension.
    
          current directory: /Users/kig/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/arg_scanner-0.3.0/ext/arg_scanner
      /Users/kig/.rbenv/versions/2.6.3/bin/ruby -I /Users/kig/.rbenv/versions/2.6.3/lib/ruby/site_ruby/2.6.0 -r ./siteconf20190708-66962-1o7qabl.rb extconf.rb
      *** extconf.rb failed ***
      Could not create Makefile due to some reason, probably lack of necessary
      libraries and/or headers.  Check the mkmf.log file for more details.  You may
      need configuration options.
    
      Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/Users/kig/.rbenv/versions/2.6.3/bin/$(RUBY_BASE_NAME)
      /Users/kig/.rbenv/versions/2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- debase/ruby_core_source (LoadError)
        from /Users/kig/.rbenv/versions/2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from extconf.rb:5:in `<main>'
    
      extconf failed, exit code 1
    
      Gem files will remain installed in /Users/kig/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/arg_scanner-0.3.0 for inspection.
      Results logged to /Users/kig/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/arg_scanner-0.3.0/gem_make.out
  2. I was able to install this gem by downloading the source of this repo, and then:

      ❯ git clone ...
      ❯ cd arg_scanner
      ❯ bundle
      Using rake 12.3.2
      Using arg_scanner 0.3.0 from source at `.`
      Using bundler 1.17.3
      Using debase-ruby_core_source 0.10.5
      Using native-package-installer 1.0.7
      Using power_assert 1.1.4
      Using rake-compiler 1.0.7
      Using test-unit 3.3.3
      Bundle complete! 7 Gemfile dependencies, 8 gems now installed.
      Use `bundle info [gemname]` to see where a bundled gem is installed.
    
      ❯ be rake install
      mkdir -p tmp/x86_64-darwin18/arg_scanner/2.6.3
      cd tmp/x86_64-darwin18/arg_scanner/2.6.3
      /Users/kig/.rbenv/versions/2.6.3/bin/ruby -I. ../../../../ext/arg_scanner/extconf.rb
      checking for glib.h... no
      checking for glib.h... no
      installing 'glib' native package... succeeded
      checking for vm_core.h... no
      checking for vm_core.h... no
      **************************************************************************
      No source for ruby-2.6.3-p62 (revision 67580) provided with
      debase-ruby_core_source gem. Falling back to ruby-2.6.0-p0.
      **************************************************************************
      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
      cd -
      cd tmp/x86_64-darwin18/arg_scanner/2.6.3
      /usr/bin/make
      compiling ../../../../ext/arg_scanner/arg_scanner.c
      clang: warning: -lglib-2.0: 'linker' input unused [-Wunused-command-line-argument]
      clang: warning: -lintl: 'linker' input unused [-Wunused-command-line-argument]
      clang: warning: argument unused during compilation: '-L/usr/local/Cellar/glib/2.60.4_1/lib' [-Wunused-command-line-argument]
      clang: warning: argument unused during compilation: '-L/usr/local/opt/gettext/lib' [-Wunused-command-line-argument]
      ../../../../ext/arg_scanner/arg_scanner.c:277:52: warning: incompatible pointer types passing 'const rb_thread_t *'
           (aka 'const struct rb_thread_struct *') to parameter of type 'const rb_execution_context_t *' (aka
           'const struct rb_execution_context_struct *') [-Wincompatible-pointer-types]
         while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) {
                                                        ^~
      /Users/kig/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/debase-ruby_core_source-0.10.5/lib/debase/ruby_core_source/ruby-2.6.0-p0/vm_core.h:1353:70: note:
           passing argument to parameter 'ec' here
      RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
                                                                          ^
      ../../../../ext/arg_scanner/arg_scanner.c:340:37: warning: passing 'char **' to parameter of type 'const char *const *' discards qualifiers
           in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
         sign->args_info = get_args_info(info.call_info_kw_explicit_args);
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:82:47: note: passing argument to parameter 'explicit_kw_args' here
      static char *get_args_info(const char *const *explicit_kw_args);
                                                   ^
      ../../../../ext/arg_scanner/arg_scanner.c:389:17: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long')
           [-Wformat]
                     sign->explicit_argc,
                     ^~~~~~~~~~~~~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:403:100: warning: incompatible integer to pointer conversion passing 'int' to parameter of type
           'gpointer' (aka 'void *') [-Wint-conversion]
             g_tree_insert(number_missed_calls_tree, /*key = */sign_in_sent_to_server_tree, /*value = */found + 1);
                                                                                                        ^~~~~~~~~
      /usr/local/Cellar/glib/2.60.4_1/include/glib-2.0/glib/gtree.h:63:52: note: passing argument to parameter 'value' here
                                      gpointer          value);
                                                        ^
      ../../../../ext/arg_scanner/arg_scanner.c:457:56: warning: assigning to 'char *' from 'const char *' discards qualifiers
           [-Wincompatible-pointer-types-discards-qualifiers]
                         info.call_info_kw_explicit_args[i] = kw_name;
                                                            ^ ~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:549:40: warning: passing 'char *[count]' to parameter of type 'const char **' discards qualifiers
           in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
         return fast_join_array(sep, count, strings);
                                            ^~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:495:54: note: passing argument to parameter 'strings' here
      fast_join_array(char sep, size_t count, const char **strings)
                                                          ^
      ../../../../ext/arg_scanner/arg_scanner.c:627:12: warning: initializing 'VALUE *' (aka 'unsigned long *') with an expression of type
           'const VALUE *' (aka 'const unsigned long *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
         VALUE *ep = cfp->ep;
                ^    ~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:759:55: warning: passing 'char **' to parameter of type 'const char **' discards qualifiers in
           nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
         char *answer = fast_join_array(';', ans_iterator, ans);
                                                           ^~~
      ../../../../ext/arg_scanner/arg_scanner.c:495:54: note: passing argument to parameter 'strings' here
      fast_join_array(char sep, size_t count, const char **strings)
                                                          ^
      ../../../../ext/arg_scanner/arg_scanner.c:784:37: warning: passing 'char **' to parameter of type 'const char *const *' discards qualifiers
           in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
         char *args_info = get_args_info(info.call_info_kw_explicit_args);
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:617:34: note: passing argument to parameter 'explicit_kw_args' here
      get_args_info(const char *const *explicit_kw_args)
                                      ^
      ../../../../ext/arg_scanner/arg_scanner.c:802:32: warning: initializing 'const char *const *' with an expression of type 'char **' discards
           qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
                 const char *const *kwarg = info.call_info_kw_explicit_args;
                                    ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:808:68: warning: passing 'char **' to parameter of type 'const char **' discards qualifiers in
           nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
                 char *answer = fast_join_array(',', explicit_kw_count, info.call_info_kw_explicit_args);
                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../../../ext/arg_scanner/arg_scanner.c:495:54: note: passing argument to parameter 'strings' here
      fast_join_array(char sep, size_t count, const char **strings)
                                                          ^
      11 warnings generated.
      linking shared-object arg_scanner/arg_scanner.bundle
      cd -
      mkdir -p tmp/x86_64-darwin18/stage/lib/arg_scanner
      install -c tmp/x86_64-darwin18/arg_scanner/2.6.3/arg_scanner.bundle lib/arg_scanner/arg_scanner.bundle
      cp tmp/x86_64-darwin18/arg_scanner/2.6.3/arg_scanner.bundle tmp/x86_64-darwin18/stage/lib/arg_scanner/arg_scanner.bundle
      arg_scanner 0.3.0 built to pkg/arg_scanner-0.3.0.gem.
      arg_scanner (0.3.0) installed.

Conflicting console

The gem additionally installs binary console which conflicts by name with another thousand gems that install a similarly named binary, including fog-dnsimple. I had to skip installing console.

Summary

My guess is that it appears that the local repo contains a newer version of the arg_scanner gem than what's posted to RubyGems. Either that, or local build does something different.

Conclusion

If you need to install arg_scanner, you may have to run bundle exec rake install from inside the folder, until the RubyGems version is updated/fixed.

nikitabobko commented 5 years ago

Thanks for report! Seems that you're right and and master has never version of debase-ruby_core_source compared to published Gem. I'm going to update plugin soon to be compatible with new Intellij IDEA 2019.2 version and I also will update gem

nikitabobko commented 4 years ago

Finally have published new gem version! Sorry for the delay