Open PervushinEugene opened 2 years ago
I would like this too :) Hoping it might help stabilise the debugging experience in ruby vscode....
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.
@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...
@iandol does that remove the need for https://github.com/ruby-debug/ruby-debug-ide too?
@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...
try install beta version
gem install debase --pre
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:
These base images get the native extension error
Is this a missing C library or something, that should be documented in the readme?
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
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
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
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.
I try to install debase and ruby-debug-ide-0.7.2
part my Gemfile
part my Dockerfile
but getting the following error
debase-0.2.5.beta2/gem_make.out
ruby-debug-ide-0.7.2/gem_make.out