gpt4 book ai didi

ruby - 尝试在 ruby​​ 脚本上运行 ruby​​-debug 时如何消除此错误

转载 作者:数据小太阳 更新时间:2023-10-29 07:46:53 24 4
gpt4 key购买 nike

我按照 here 中的说明进行操作但仍然无法找出问题所在。很高兴听到一些建议。提前致谢!

stanley@ubuntu:~/Github/webdev_class/ruby$ gem install ruby-debug19
Fetching: archive-tar-minitar-0.5.2.gem (100%)
Fetching: ruby_core_source-0.1.5.gem (100%)
Fetching: linecache19-0.5.12.gem (100%)
Building native extensions. This could take a while...
Fetching: ruby-debug-base19-0.11.25.gem (100%)
Building native extensions. This could take a while...
Fetching: ruby-debug19-0.11.6.gem (100%)
Successfully installed archive-tar-minitar-0.5.2
Successfully installed ruby_core_source-0.1.5
Successfully installed linecache19-0.5.12
Successfully installed ruby-debug-base19-0.11.25
Successfully installed ruby-debug19-0.11.6
5 gems installed
Installing ri documentation for archive-tar-minitar-0.5.2...
Building YARD (yri) index for archive-tar-minitar-0.5.2...
Installing ri documentation for ruby_core_source-0.1.5...
Building YARD (yri) index for ruby_core_source-0.1.5...
Installing ri documentation for linecache19-0.5.12...
Building YARD (yri) index for linecache19-0.5.12...
Installing ri documentation for ruby-debug-base19-0.11.25...
Building YARD (yri) index for ruby-debug-base19-0.11.25...
Installing ri documentation for ruby-debug19-0.11.6...
Building YARD (yri) index for ruby-debug19-0.11.6...
Installing RDoc documentation for archive-tar-minitar-0.5.2...
Installing RDoc documentation for ruby_core_source-0.1.5...
Installing RDoc documentation for linecache19-0.5.12...
Installing RDoc documentation for ruby-debug-base19-0.11.25...
Installing RDoc documentation for ruby-debug19-0.11.6...
stanley@ubuntu:~/Github/webdev_class/ruby$ ruby-debug ex39.rb
ruby-debug: command not found
stanley@ubuntu:~/Github/webdev_class/ruby$ ruby-debug19
ruby-debug19: command not found
stanley@ubuntu:~/Github/webdev_class/ruby$ rdebug ex40.rb
/home/stanley/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require': /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
from /home/stanley/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /home/stanley/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
from /home/stanley/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/stanley/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
from /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/bin/rdebug:108:in `require_relative'
from /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/bin/rdebug:108:in `<top (required)>'
from /home/stanley/.rvm/gems/ruby-1.9.3-p194/bin/rdebug:19:in `load'
from /home/stanley/.rvm/gems/ruby-1.9.3-p194/bin/rdebug:19:in `<main>'

------------更新----------------------------

我尝试卸载并重新安装 ruby​​-debug 和 linecache,但仍然失败。这是发生的事情的日志:

stanley@ubuntu:~/Github/webdev_class/ruby$ gem install linecache
Building native extensions. This could take a while...
ERROR: Error installing linecache:
ERROR: Failed to build gem native extension.

/home/stanley/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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
--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=/home/stanley/.rvm/rubies/ruby-1.9.3-p194/bin/ruby


Gem files will remain installed in /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/linecache-0.46 for inspection.
Results logged to /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/linecache-0.46/ext/gem_make.out
stanley@ubuntu:~/Github/webdev_class/ruby$ gem uninstall linecache
INFO: gem "linecache" is not installed
stanley@ubuntu:~/Github/webdev_class/ruby$ gem install linecache
Building native extensions. This could take a while...
ERROR: Error installing linecache:
ERROR: Failed to build gem native extension.

/home/stanley/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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
--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=/home/stanley/.rvm/rubies/ruby-1.9.3-p194/bin/ruby


Gem files will remain installed in /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/linecache-0.46 for inspection.
Results logged to /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/linecache-0.46/ext/gem_make.out
stanley@ubuntu:~/Github/webdev_class/ruby$ gem uninstall ruby-debug
INFO: gem "ruby-debug" is not installed
stanley@ubuntu:~/Github/webdev_class/ruby$ gem install ruby-debug
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.

/home/stanley/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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
--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=/home/stanley/.rvm/rubies/ruby-1.9.3-p194/bin/ruby


Gem files will remain installed in /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/linecache-0.46 for inspection.
Results logged to /home/stanley/.rvm/gems/ruby-1.9.3-p194/gems/linecache-0.46/ext/gem_make.out

最佳答案

最终通过安装 gem debugger 解决了我的问题相反:http://rubygems.org/gems/debugger

  • 将 gem 添加到您的 Gemfile:gem 'debugger', group: [:development, :test]
  • 运行 bundler :bundle install

如果您需要有关如何使用 gem 的指导,请观看视频教程 Creating a blog in 15 minutes with Rails - Part 2 .基本上,您需要做两件事来中断服务器呈现页面。

  • 添加命令debugger在你的 ruby​​ 代码中的某个地方。如果它是一个 View ,请使用 <% debugger %>相反。
  • 使用参数启动服务器:rails server --debugger

关于ruby - 尝试在 ruby​​ 脚本上运行 ruby​​-debug 时如何消除此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10569672/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com