Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3.0.0 compatibilty #92

Closed
Govinda-Fichtner opened this issue Dec 26, 2020 · 10 comments
Closed

Ruby 3.0.0 compatibilty #92

Govinda-Fichtner opened this issue Dec 26, 2020 · 10 comments

Comments

@Govinda-Fichtner
Copy link

I am currently getting the following error when I try to install debase:

# gem install debase
Building native extensions. This could take a while...
ERROR:  Error installing debase:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/debase-0.2.4.1/ext
/root/.rbenv/versions/3.0.0/bin/ruby -I /root/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20201226-13989-9lckur.rb extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
**************************************************************************
No source for ruby-3.0.0-p0 (revision 95aff214687a5e12c3eb57d056665741e734c188) provided with
debase-ruby_core_source gem. Falling back to ruby-3.0.0-preview1.
**************************************************************************
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: /usr/local/bundle/gems/debase-0.2.4.1/ext
make "DESTDIR=" clean

current directory: /usr/local/bundle/gems/debase-0.2.4.1/ext
make "DESTDIR="
compiling breakpoint.c
compiling context.c
compiling debase_internals.c
In file included from ./hacks.h:1,
                 from debase_internals.c:2:
/usr/local/bundle/gems/debase-ruby_core_source-0.10.11/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_core.h:1617:21: error: expected declaration specifiers or '...' before '*' token
 1617 | typedef RETSIGTYPE (*ruby_sighandler_t)(int);
      |                     ^
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/defines.h:73,
                 from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:23,
                 from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
                 from ./debase_internals.h:4,
                 from debase_internals.c:1:
/usr/local/bundle/gems/debase-ruby_core_source-0.10.11/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_core.h:1618:39: error: unknown type name 'ruby_sighandler_t'; did you mean 'sighandler_t'?
 1618 | NORETURN(void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt, ...));
      |                                       ^~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward/2/attributes.h:152:44: note: in definition of macro 'NORETURN'
  152 | #define NORETURN(x) RBIMPL_ATTR_NORETURN() x
      |                                            ^
debase_internals.c: In function 'print_debug':
debase_internals.c:36:3: warning: function 'print_debug' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
   36 |   vfprintf(stderr, message, ap);
      |   ^~~~~~~~
debase_internals.c: In function 'try_disable_trace_points':
debase_internals.c:111:8: warning: implicit declaration of function 'RHASH_EMPTY_P' [-Wimplicit-function-declaration]
  111 |   if (!RHASH_EMPTY_P(catchpoints)) return;
      |        ^~~~~~~~~~~~~
debase_internals.c: In function 'count_stack_size':
debase_internals.c:319:37: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  319 |     rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(TH_INFO(thread));
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
                 from ./debase_internals.h:4,
                 from debase_internals.c:1:
debase_internals.c: In function 'Init_debase_internals':
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/anyargs.h:337:142: warning: passing argument 3 of 'rb_define_module_function_01' from incompatible pointer type [-Wincompatible-pointer-types]
  337 | #define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
      |                                                                                                                                              ^~~~~~
      |                                                                                                                                              |
      |                                                                                                                                              void (*)(VALUE,  VALUE) {aka void (*)(long unsigned int,  long unsigned int)}
debase_internals.c:768:3: note: in expansion of macro 'rb_define_module_function'
  768 |   rb_define_module_function(mDebase, "set_trace_flag_to_iseq", Debase_set_trace_flag_to_iseq, 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/anyargs.h:273:21: note: expected 'VALUE (*)(VALUE,  VALUE)' {aka 'long unsigned int (*)(long unsigned int,  long unsigned int)'} but argument is of type 'void (*)(VALUE,  VALUE)' {aka 'void (*)(long unsigned int,  long unsigned int)'}
  273 | RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/anyargs.h:255:41: note: in definition of macro 'RBIMPL_ANYARGS_DECL'
  255 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _01(__VA_ARGS__, VALUE(*)(VALUE, VALUE), int); \
      |                                         ^~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/anyargs.h:337:142: warning: passing argument 3 of 'rb_define_module_function_01' from incompatible pointer type [-Wincompatible-pointer-types]
  337 | #define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
      |                                                                                                                                              ^~~~~~
      |                                                                                                                                              |
      |                                                                                                                                              void (*)(VALUE,  VALUE) {aka void (*)(long unsigned int,  long unsigned int)}
debase_internals.c:771:3: note: in expansion of macro 'rb_define_module_function'
  771 |   rb_define_module_function(mDebase, "unset_iseq_flags", Debase_unset_trace_flags, 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/anyargs.h:273:21: note: expected 'VALUE (*)(VALUE,  VALUE)' {aka 'long unsigned int (*)(long unsigned int,  long unsigned int)'} but argument is of type 'void (*)(VALUE,  VALUE)' {aka 'void (*)(long unsigned int,  long unsigned int)'}
  273 | RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/anyargs.h:255:41: note: in definition of macro 'RBIMPL_ANYARGS_DECL'
  255 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _01(__VA_ARGS__, VALUE(*)(VALUE, VALUE), int); \
      |                                         ^~~
debase_internals.c: At top level:
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-parentheses-equality'
cc1: warning: unrecognized command line option '-Wno-constant-logical-operand'
make: *** [Makefile:245: debase_internals.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/bundle/gems/debase-0.2.4.1 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux-musl/3.0.0/debase-0.2.4.1/gem_make.out

I am getting this error with a standard alpine ruby image (ruby:3.0-rc-alpine) or by using a rbenv installed ruby version.

Any ideas how to fix it?

@hurricup
Copy link
Contributor

ruby3-compatible gem wasn't released yet.

@Govinda-Fichtner
Copy link
Author

@hurricup Is there already a beta version that one can test drive? Any expectations for when a ruby3 compatible gem could arrive?

@hurricup
Copy link
Contributor

Not yet

@hurricup
Copy link
Contributor

Please, check https://github.com/ruby-debug/debase/releases/tag/v0.2.5.beta2

@casperisfine
Copy link

@hurricup no huge deal, but could we have a non-beta release?

@EverardB
Copy link

Is there anything on the roadmap for the 0.2.5 (non-beta) release?

@hurricup
Copy link
Contributor

@EverardB for now main goal is to migrate from debase to the new debugging gem bundled with new ruby versions.

instructure-gerrit pushed a commit to instructure/canvas-lms that referenced this issue Feb 1, 2022
The ruby debug open source contributors have released a beta form of
debase to address Ruby 3.0.0+ compatibility. Their main goal is to
migrate from debase to the new debugging gem bundled with new ruby
versions, so it's not a priority for them to release something that
is non-beta.

See: ruby-debug/debase#92 for more info.

flag = none

Test plan:
• `bundle install` doesn't blow up with a fresh install of Ruby 3+

Change-Id: Ib476ce0eed6a5b6a9f006d9355323857cd7db470
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284078
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Jacob Burroughs <[email protected]>
QA-Review: August Thornton <[email protected]>
Product-Review: August Thornton <[email protected]>
@BenSandeen
Copy link

BenSandeen commented Mar 22, 2023

@EverardB for now main goal is to migrate from debase to the new debugging gem bundled with new ruby versions.

@hurricup Are you referring to the gem named debugging? This one, right? https://rubygems.org/gems/debugging

Update: After looking at that gem more, I'm less confident that's the correct one :/

@hurricup
Copy link
Contributor

@BenSandeen no, https://github.com/ruby/debug

@AndyObtiva
Copy link

I am having a similar issue on my M2 Chip Mac ARM64 (Sonoma 14.4 & ruby 3.0.6p216 & xcode-select version 2406):

% gem install debase -v0.2.5.beta2                                                            
Fetching debase-ruby_core_source-3.3.1.gem
Fetching debase-0.2.5.beta2.gem
Successfully installed debase-ruby_core_source-3.3.1
Building native extensions. This could take a while...
ERROR:  Error installing debase:
  ERROR: Failed to build gem native extension.

    current directory: ~/.rvm/gems/ruby-3.0.6@debase-temp/gems/debase-0.2.5.beta2/ext
~/.rvm/rubies/ruby-3.0.6/bin/ruby -I ~/.rvm/rubies/ruby-3.0.6/lib/ruby/3.0.0 -r ./siteconf20240321-87109-znf1i2.rb extconf.rb
checking for vm_core.h... yes
checking for iseq.h... yes
checking for version.h... yes
creating Makefile

current directory: ~/.rvm/gems/ruby-3.0.6@debase-temp/gems/debase-0.2.5.beta2/ext
make DESTDIR\= clean

current directory: ~/.rvm/gems/ruby-3.0.6@debase-temp/gems/debase-0.2.5.beta2/ext
make DESTDIR\=
compiling breakpoint.c
compiling context.c
compiling debase_internals.c
debase_internals.c:319:25: warning: initializing 'rb_control_frame_t *' (aka 'struct rb_control_frame_struct *') with an expression of type 'const rb_control_frame_t *' (aka 'const struct rb_control_frame_struct *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(TH_INFO(thread));
                        ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
debase_internals.c:770:3: error: incompatible function pointer types passing 'void (VALUE, VALUE)' (aka 'void (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_module_function(mDebase, "set_trace_flag_to_iseq", Debase_set_trace_flag_to_iseq, 1);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/.rvm/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/internal/anyargs.h:337:142: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
                                                                                                                                             ^~~~~~
~/.rvm/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/internal/anyargs.h:273:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
^
~/.rvm/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/internal/anyargs.h:255:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _01(__VA_ARGS__, VALUE(*)(VALUE, VALUE), int); \
                                                                       ^
debase_internals.c:773:3: error: incompatible function pointer types passing 'void (VALUE, VALUE)' (aka 'void (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_module_function(mDebase, "unset_iseq_flags", Debase_unset_trace_flags, 1);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/.rvm/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/internal/anyargs.h:337:142: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
                                                                                                                                             ^~~~~~
~/.rvm/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/internal/anyargs.h:273:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
^
~/.rvm/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/internal/anyargs.h:255:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _01(__VA_ARGS__, VALUE(*)(VALUE, VALUE), int); \
                                                                       ^
1 warning and 2 errors generated.
make: *** [debase_internals.o] Error 1

make failed, exit code 2

Gem files will remain installed in ~/.rvm/gems/ruby-3.0.6@debase-temp/gems/debase-0.2.5.beta2 for inspection.
Results logged to ~/.rvm/gems/ruby-3.0.6@debase-temp/extensions/arm64-darwin-23/3.0.0/debase-0.2.5.beta2/gem_make.out

I was able to resolve the issue by installing the gem with cflags:

gem install debase -v0.2.5.beta2 -- --with-cflags="-Wno-incompatible-function-pointer-types"

Still, it would be better in the future if I didn't have to set those cflags and could install the gem normally instead.

By the way, one weird thing I discovered from a coworker who uses RubyMine (I don't, but share the same project that has the debase and ruby-debug-ide gems in the development gem group) is he has version 3.0.0.beta10 & 3.0.0.beta15 of debase and ruby-debug-ide respectively, which are NOT on rubygems.org as of today (2024-03-21).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants