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.2 compatibilty #94

Open
PervushinEugene opened this issue Sep 7, 2021 · 11 comments
Open

Ruby 3.0.2 compatibilty #94

PervushinEugene opened this issue Sep 7, 2021 · 11 comments

Comments

@PervushinEugene
Copy link

I try to install debase and ruby-debug-ide-0.7.2

part my Gemfile

  gem 'debase', '0.2.5.beta2', 
  gem 'ruby-debug-ide', '~> 0.7.2'

part my Dockerfile

FROM ruby:3.0.2-buster

RUN apt update
RUN apt install -y \
    git \
    libxml2-dev \
    libxslt-dev \
    && gem install bundler

but getting the following error

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/circleci/src/.bundler/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/ext
/usr/local/bin/ruby mkrf_conf.rb
Installing base gem
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Failed to build gem native extension.

current directory:
/home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r
./siteconf20210907-778-tnuf1c.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=/usr/local/bin/$(RUBY_BASE_NAME)
<internal:/usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in
`require': cannot load such file -- debase/ruby_core_source (LoadError)
from
<internal:/usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in
`require'
	from extconf.rb:28:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in
/home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2 for inspection.
Results logged to
/home/circleci/src/.bundler/ruby/3.0.0/extensions/x86_64-linux/3.0.0/debase-0.2.5.beta2/gem_make.out
/usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:91:in `run'
/usr/local/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:48:in `block in
build'
  /usr/local/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /usr/local/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:28:in `build'
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:157:in `build_extension'
/usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:191:in `block in
build_extensions'
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:188:in `each'
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:188:in `build_extensions'
  /usr/local/lib/ruby/3.0.0/rubygems/installer.rb:828:in `build_extensions'
  /usr/local/lib/ruby/3.0.0/rubygems/installer.rb:312:in `install'
  /usr/local/lib/ruby/3.0.0/rubygems/resolver/specification.rb:104:in `install'
/usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:279:in `block in
install_into'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:271:in `each'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:271:in `install_into'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:147:in `install'
  /usr/local/lib/ruby/3.0.0/rubygems/dependency_installer.rb:252:in `install'
  mkrf_conf.rb:31:in `rescue in <main>'
  mkrf_conf.rb:24:in `<main>'

rake failed, exit code 1

Gem files will remain installed in
/home/circleci/src/.bundler/ruby/3.0.0/gems/ruby-debug-ide-0.7.2 for inspection.
Results logged to
/home/circleci/src/.bundler/ruby/3.0.0/extensions/x86_64-linux/3.0.0/ruby-debug-ide-0.7.2/gem_make.out

An error occurred while installing ruby-debug-ide (0.7.2), and Bundler
cannot continue.
Make sure that `gem install ruby-debug-ide -v '0.7.2' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  ruby-debug-ide

Exited with code exit status 5

debase-0.2.5.beta2/gem_make.out

~$ cat /home/circleci/src/.bundler/ruby/3.0.0/extensions/x86_64-linux/3.0.0/debase-0.2.5.beta2/gem_make.out
current directory: /home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2/ext/attach
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r ./siteconf20210907-112-m10uv7.rb extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
**************************************************************************
No source for ruby-3.0.2-p107 (revision 0db68f023372b634603c74fca94588b457be084c) provided with
debase-ruby_core_source gem. Falling back to ruby-3.0.0-p0.
**************************************************************************
checking for vm_core.h... yes
checking for iseq.h... yes
checking for version.h... yes
creating Makefile       
                                                               
current directory: /home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2/ext/attach
make DESTDIR\= clean  
                                                               
current directory: /home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2/ext/attach                                                                                                                                                                  
make DESTDIR\=
compiling attach.c
linking shared-object attach.so

current directory: /home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2/ext/attach
make DESTDIR\= install
/usr/bin/install -c -m 0755 attach.so ./.gem.20210907-112-oi5vck

**ruby-debug-ide-0.7.2/gem_make.out **

~$ cat /home/circleci/src/.bundler/ruby/3.0.0/extensions/x86_64-linux/3.0.0/ruby-debug-ide-0.7.2/gem_make.out                                                                                                                           
current directory: /home/circleci/src/.bundler/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/ext                                                                                                                                                                       
/usr/local/bin/ruby mkrf_conf.rb                                                                                                                                                                                                                              
Installing base gem                                                                                                                                                                                                                                           
Building native extensions. This could take a while...                                                                                                                                                                                                        
Building native extensions. This could take a while...                                                                                                                                                                                                        
ERROR: Failed to build gem native extension.                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                              
    current directory: /home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2/ext                                                                                                                                                                     
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r ./siteconf20210907-786-cy6qm5.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=/usr/local/bin/$(RUBY_BASE_NAME)                                                                                                                                                                                                               
<internal:/usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- debase/ruby_core_source (LoadError)                                                                                                        
        from <internal:/usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'                                                                                                                                                         
        from extconf.rb:28:in `<main>'                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                              
extconf failed, exit code 1                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                              
Gem files will remain installed in /home/circleci/src/.bundler/ruby/3.0.0/gems/debase-0.2.5.beta2 for inspection.                                                                                                                                             
Results logged to /home/circleci/src/.bundler/ruby/3.0.0/extensions/x86_64-linux/3.0.0/debase-0.2.5.beta2/gem_make.out                                                                                                                                        
/usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:91:in `run'                                                                                                                                                                                                 
  /usr/local/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:48:in `block in build'                                                                                                                                                                           
  /usr/local/lib/ruby/3.0.0/tempfile.rb:317:in `open'                                                                                                                                                                                                         
  /usr/local/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:28:in `build'                                                                                                                                                                                    
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:157:in `build_extension'                                                                                                                                                                                  
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:191:in `block in build_extensions'
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:188:in `each'
  /usr/local/lib/ruby/3.0.0/rubygems/ext/builder.rb:188:in `build_extensions'                                                                                                                                                                                 
  /usr/local/lib/ruby/3.0.0/rubygems/installer.rb:828:in `build_extensions'                                                                                                                                                                                   
  /usr/local/lib/ruby/3.0.0/rubygems/installer.rb:312:in `install'
  /usr/local/lib/ruby/3.0.0/rubygems/resolver/specification.rb:104:in `install'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:279:in `block in install_into'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:271:in `each'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:271:in `install_into'
  /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb:147:in `install'
  /usr/local/lib/ruby/3.0.0/rubygems/dependency_installer.rb:252:in `install'
  mkrf_conf.rb:31:in `rescue in <main>'
  mkrf_conf.rb:24:in `<main>'
                                                               
rake failed, exit code 1   

@jabamaus
Copy link

I would like this too :) Hoping it might help stabilise the debugging experience in ruby vscode....

@jabamaus
Copy link

I got as far as adding 3.0.2p107 to debase-ruby_core_source and submitting a pull request... Hoping an expert can do the débase part.

@iandol
Copy link

iandol commented Nov 24, 2021

@jabamaus — You could use the new official debug gem https://github.com/ruby/debug and debug extension for VSCode: https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg — works reliably in 3.0.2 for me...

@AlecRust
Copy link

@iandol does that remove the need for https://github.com/ruby-debug/ruby-debug-ide too?

@iandol
Copy link

iandol commented Nov 25, 2021

@AlecRust Yes, it is a single ruby gem and one extension. The extension is very new, so there may be teething troubles. But at least for my requirements of remote debugger triggered within-the-code, this is already much more useful. ruby/debug will be officially bundled in 3.1 and Rails 7 (replacing byebug), so it also makes sense to move over as it will better support new ruby versions...

elliotcm added a commit to DFE-Digital/teaching-vacancies that referenced this issue Dec 1, 2021
@iefhong
Copy link

iefhong commented Dec 13, 2021

try install beta version
gem install debase --pre

@collinsauve
Copy link

collinsauve commented Jan 15, 2022

This does not seem to be just a Ruby 3.x problem. See https://github.com/collinsauve/ruby-debug-ide-test/branches

These base images build:

  • ruby:2.7.1
  • ruby:3.0.3

These base images get the native extension error

  • ruby:2.7.1-slim-buster
  • ruby:3.0.3-slim-bullseye
  • ruby:3.0.3-slim-buster
  • ruby:3.1.0 (this is a slightly different error)
  • ruby:3.1.0-slim-bullseye

Is this a missing C library or something, that should be documented in the readme?

@collinsauve
Copy link

collinsauve commented Jan 15, 2022

Here's the output from the ruby-2.7.1-slim-buster branch:

csauve@csauve-msi-ubuntu ~/src/ruby-debug-ide-test (ruby-2.7.1-slim-buster) $ docker build ./
Sending build context to Docker daemon  218.6kB
Step 1/7 : FROM ruby:2.7.1-slim-buster
 ---> d1660c0e5eb6
Step 2/7 : RUN addgroup --gid 2000 app &&     adduser --system --home /home/app --uid 1000 --disabled-password --ingroup app app
 ---> Using cache
 ---> 1db784889f94
Step 3/7 : WORKDIR /home/app
 ---> Using cache
 ---> e45c6bc93613
Step 4/7 : COPY --chown=1000:2000 . .
 ---> 41373adee297
Step 5/7 : USER 1000:2000
 ---> Running in 74fd1e74ec7d
Removing intermediate container 74fd1e74ec7d
 ---> ec82253a177f
Step 6/7 : ENV BUNDLE_APP_CONFIG=.bundle
 ---> Running in 5b244d4c6abf
Removing intermediate container 5b244d4c6abf
 ---> 4475549b1fe2
Step 7/7 : RUN bundle config --global frozen 1 &&     bundle config set deployment 'true' &&     bundle install
 ---> Running in 0340c5e140c9
Fetching gem metadata from https://rubygems.org/.....
Fetching rake 13.0.6
Installing rake 13.0.6
Using bundler 2.1.4
Fetching debase-ruby_core_source 0.10.12
Installing debase-ruby_core_source 0.10.12
Fetching debase 0.2.5.beta2
Installing debase 0.2.5.beta2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/app/vendor/bundle/ruby/2.7.0/gems/debase-0.2.5.beta2/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r
./siteconf20220115-9-nnvkxz.rb extconf.rb
checking for vm_core.h... *** 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=/usr/local/bin/$(RUBY_BASE_NAME)
	--with-ruby-dir
	--without-ruby-dir
	--with-ruby-include
	--without-ruby-include=${ruby-dir}/include
	--with-ruby-lib
	--without-ruby-lib=${ruby-dir}/lib
	--with-vm_core-dir
	--without-vm_core-dir
	--with-vm_core-include
	--without-vm_core-include=${vm_core-dir}/include
	--with-vm_core-lib
	--without-vm_core-lib=${vm_core-dir}/lib
/usr/local/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to
generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:613:in `try_cpp'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:1124:in `block in have_header'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:971:in `block in checking_for'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:361:in `block (2 levels) in postpone'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:331:in `open'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:361:in `block in postpone'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:331:in `open'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:357:in `postpone'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:970:in `checking_for'
	from /usr/local/lib/ruby/2.7.0/mkmf.rb:1123:in `have_header'
	from extconf.rb:31:in `block in <main>'
from
/home/app/vendor/bundle/ruby/2.7.0/gems/debase-ruby_core_source-0.10.12/lib/debase/ruby_core_source.rb:15:in
`create_makefile_with_core'
	from extconf.rb:51:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/home/app/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/debase-0.2.5.beta2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/app/vendor/bundle/ruby/2.7.0/gems/debase-0.2.5.beta2 for inspection.
Results logged to
/home/app/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/debase-0.2.5.beta2/gem_make.out

An error occurred while installing debase (0.2.5.beta2), and Bundler cannot
continue.
Make sure that `gem install debase -v '0.2.5.beta2' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  debase
The command '/bin/sh -c bundle config --global frozen 1 &&     bundle config set deployment 'true' &&     bundle install' returned a non-zero code: 5

@AirWick219
Copy link

Got the same error with ruby 3.0.0 but was able to install debase-0.2.5.beta2 after installing debase-ruby_core_source

got the idea from here

gem install debase-ruby_core_source 

Screen Shot 2022-03-02 at 6 48 01 PM

Screen Shot 2022-03-02 at 6 48 39 PM

Screen Shot 2022-03-02 at 6 49 21 PM

@zhouluyao2020
Copy link

upgrade ruby,it's work for me!
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
brew install ruby

➜ ~ brew install ruby

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/libyaml-0.2.5.big_s
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/ruby-3.0.1.big_sur.
#=#=#
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/manifests/3.0.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/blobs/sha256:00daa93e4b30d
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for ruby: libyaml
==> Installing ruby dependency: libyaml
==> Pouring libyaml-0.2.5.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/libyaml/0.2.5: 10 files, 348.4KB
==> Installing ruby
==> Pouring ruby--3.0.1.big_sur.bottle.tar.gz
==> Caveats
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/3.0.0/bin

You may want to add this to your PATH.

ruby is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have ruby first in your PATH, run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"

For pkg-config to find ruby you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/ruby/3.0.1: 16,358 files, 38.4MB
==> Caveats
==> ruby
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/3.0.0/bin

You may want to add this to your PATH.

ruby is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have ruby first in your PATH, run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"

For pkg-config to find ruby you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

sudo gem install debase -v '0.2.5.beta2'

Password:
Fetching debase-0.2.5.beta2.gem
Fetching debase-ruby_core_source-0.10.14.gem
Successfully installed debase-ruby_core_source-0.10.14
Building native extensions. This could take a while...
Successfully installed debase-0.2.5.beta2
Parsing documentation for debase-ruby_core_source-0.10.14
Installing ri documentation for debase-ruby_core_source-0.10.14
Parsing documentation for debase-0.2.5.beta2
Installing ri documentation for debase-0.2.5.beta2
Done installing documentation for debase-ruby_core_source, debase after 6 seconds
2 gems installed

@rgalanakis
Copy link

rgalanakis commented Mar 6, 2022

I am using rbenv, I was able to copy ~/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/debase-ruby_core_source-0.10.14/lib/debase into ~/.rbenv/versions/3.1.1/lib/ruby/3.1.0/debase, next to the Ruby stdlib files/folders, so the build step could fine the needed files. Not the worst hack I've had to do.

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

9 participants