为什么我在尝试启动 Rails 控制台时收到 Readline 错误?

发布于 2025-01-06 01:23:40 字数 2799 浏览 1 评论 0原文

更新:我在尝试其他地方找到的解决方案时可能弄乱了我的系统。我从头开始,顺利安装了 Ruby 1.9.3。现在尝试让 ree-1.8.7 一起工作......


我正在尝试在 Kubuntu 上使用 RVM 安装 Ruby 1.9.3(我相信是 11.10)。到目前为止,我在 Readline 上遇到了很多问题,但除了这个问题之外,我找到了所有问题的答案。

我以这种方式安装了 Ruby 1.9.3:

rvm install 1.9.3
# Install of ruby-1.9.3-p0 - #complete 
cd ~/.rvm/src/ruby-1.9.3-p0/ext/readline/
~/.rvm/src/ruby-1.9.3-p0/ext/readline $ ../../ruby extconf.rb --with-editline-dir="/usr" --with-readline-dir="/usr"
# any other way of doing this resulted in simply readline not being loaded when trying to start the console
# I have libreadline6 and libreadline6-dev installed (and all the packages requested in `rvm requirements`
make install
# compiling readline.c                                                                                                                                                                                      
# linking shared-object readline.so                                                                                                                                                                         
# /usr/bin/install -c -m 0755 readline.so /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux                                                                                    
# installing default readline libraries 

到目前为止,一切看起来都运行正常,但是当我尝试启动控制台时,出现此错误:

/home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': /home/mbillard/.rvm/usr/lib/libreadline.so.6: undefined symbol: UP - /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux/readline.so (LoadError)
  from /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `require'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `<top (required)>'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands.rb:38:in `require'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands.rb:38:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

我尝试使用 rvm install 1.9.3 --with-readline-dir=" $rvm_path/usr" 并在上面的命令中编译 Readline 时使用 $rvm_path 但这些导致了此错误:

checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no

所以,感谢您提供的任何帮助。

UPDATE: I probably messed up my system while trying solutions found somewhere else. I started from scratch and Ruby 1.9.3 installed without a hitch. Now to try to get ree-1.8.7 to play nice alongside...


I'm trying to install Ruby 1.9.3 using RVM on Kubuntu (11.10 I believe). I've been having plenty of issues with Readline so far, but found the answer to all but this one.

I installed Ruby 1.9.3 this way:

rvm install 1.9.3
# Install of ruby-1.9.3-p0 - #complete 
cd ~/.rvm/src/ruby-1.9.3-p0/ext/readline/
~/.rvm/src/ruby-1.9.3-p0/ext/readline $ ../../ruby extconf.rb --with-editline-dir="/usr" --with-readline-dir="/usr"
# any other way of doing this resulted in simply readline not being loaded when trying to start the console
# I have libreadline6 and libreadline6-dev installed (and all the packages requested in `rvm requirements`
make install
# compiling readline.c                                                                                                                                                                                      
# linking shared-object readline.so                                                                                                                                                                         
# /usr/bin/install -c -m 0755 readline.so /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux                                                                                    
# installing default readline libraries 

So far everything looks to have run properly but when I try to start the console I get this error:

/home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': /home/mbillard/.rvm/usr/lib/libreadline.so.6: undefined symbol: UP - /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux/readline.so (LoadError)
  from /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `require'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `<top (required)>'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands.rb:38:in `require'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands.rb:38:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

I tried using rvm install 1.9.3 --with-readline-dir="$rvm_path/usr" and using $rvm_path when compiling Readline in the command above but those resulted in this error:

checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no

So, thanks for any help you can provide.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

塔塔猫 2025-01-13 01:23:40

请阅读以下输出:

rvm requirements

它将显示您需要安装以充分利用 Ruby 的库列表

安装所有库后,清理 rvm 安装的库并重新安装 Ruby:

rm -rf $rvm_path/usr
rvm reinstall 1.9.3

Please read the output of:

rvm requirements

It will show you list of libraries you need to install to make good use of Ruby

After installing all the libs, clean rvm installed libs and reinstall Ruby:

rm -rf $rvm_path/usr
rvm reinstall 1.9.3
瑾兮 2025-01-13 01:23:40

您需要安装 readline 开发包。 (这就是我的答案与其他现有答案的不同之处):

apt-get install libreadline-dev

这样做之后,您可以重新安装 Ruby(正如 @mpapis 已经提到的那样),一切都应该正常。

rvm reinstall 1.9.3

You need to install the readline development packages. (This is how my answer differs from the other existing one):

apt-get install libreadline-dev

After doing so, you can reinstall Ruby (as @mpapis already mentioned) and everything should work.

rvm reinstall 1.9.3
琉璃繁缕 2025-01-13 01:23:40

我有类似的问题。尝试

brew link readline --force

一下对我有用。

我从这里得到了解决方案:

Rails Console Not Loading

I had a similar issue. try

brew link readline --force

that worked for me.

I got the solution from here:

Rails Console Not Loading

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文