Rails3 和 readline 问题

发布于 2024-10-28 06:09:52 字数 2078 浏览 5 评论 0原文

我第一次在 rvm 中使用rails3(我已经使用rails2很多年了)。尝试启动控制台时,我收到此错误:

require': no such file to load -- readline

我用谷歌搜索了一下,这似乎是一个常见问题。大多数解决方案似乎涉及 1)安装以下内容:sudo apt-get install libncurses5-dev libreadline5-dev 2)进入readline的gem文件夹,运行ruby extconf.rb生成一个makefile 3)执行 makemake install

现在,我的 rvm 中没有安装 readline,所以我尝试安装它。但无法弄清楚 gem 是什么:gem install readline 没有给出任何结果。我发现的唯一一个是gem install rdp-rb-readline。我安装了两个开发库,安装了 rdp-rb-readline gem,转到后续的 gem 文件夹,然后运行 ​​ruby​​ extconf.rb。这确实生成了一个 makefile。但我无法make它或make install:我收到这些错误:

最大笔记本电脑:readline$ make 抄送-I。 -我。 -I/usr/lib/ruby/1.8/i486-linux -I。 -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_USERNAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS - DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EVENT_HOOK -DHAVE_RL_CLEANUP_AFTER_信号 -DHAVE_RL_CLEAR_SIGNALS -DHAVE_RL_VI_EDITING_MODE -DHAVE_RL_EMACS_EDITING_MODE -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c readline.c readline.c:在函数“readline_readline”中: readline.c:82: 错误:'rb_io_t' 未声明(在此函数中首次使用) readline.c:82: 错误:(每个未声明的标识符仅报告一次 readline.c:82: 错误:对于它出现的每个函数。) readline.c:82: 错误:'ofp' 未声明(在此函数中首次使用) readline.c:82: 错误:'ifp' 未声明(在此函数中首次使用) make: *** [readline.o] 错误 1

现在有点卡住了。我是否缺少一些其他基本的东西,我需要制作所需的库/宝石/其他东西?

感谢您的任何建议 - 最大

解决方案: 我实际上刚刚解决了这个问题 - 我卸载了 rdp-rb-readline gem,然后做了 gem install rb-readline,然后将 gem 'rb-readline' 添加到我的应用程序的 Gemfile 。我想它只需要知道在哪里寻找阅读线的东西,如果它不在通常的地方。我不需要对 extconf.rb 做任何事情,这很好,因为 rb-readline gem 没有。

我将其留在问题的末尾,因为a)其他人可能比我的尝试和错误方法更好地理解问题,b)以防其他人遇到同样的问题。

I'm using rails3 for the first time (i've been using rails2 for years) inside an rvm. Trying to start the console, i get this error:

require': no such file to load -- readline

I've googled around and this seems to be a common problem. Most solutions seem to involve 1) installing the following: sudo apt-get install libncurses5-dev libreadline5-dev
2) going to the gem folder for readline, running ruby extconf.rb which generates a makefile
3) doing make and make install

Now, i didn't have readline installed in my rvm, so i tried to install it. But couldn't work out what the gem is: gem install readline doesn't give any results. The only one i found was gem install rdp-rb-readline. I installed the two dev libraries, installed the rdp-rb-readline gem, went to the subsequent gem folder, and ran ruby extconf.rb. This did indeed generate a makefile. But i can't make it or make install: i get these errors:


max-laptop:readline$ make
cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_USERNAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS -DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EVENT_HOOK -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_RL_CLEAR_SIGNALS -DHAVE_RL_VI_EDITING_MODE -DHAVE_RL_EMACS_EDITING_MODE -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c readline.c
readline.c: In function ‘readline_readline’:
readline.c:82: error: ‘rb_io_t’ undeclared (first use in this function)
readline.c:82: error: (Each undeclared identifier is reported only once
readline.c:82: error: for each function it appears in.)
readline.c:82: error: ‘ofp’ undeclared (first use in this function)
readline.c:82: error: ‘ifp’ undeclared (first use in this function)
make: *** [readline.o] Error 1

Kind of stuck now. Am i missing something else fundamental that i need to make the required libraries/gem/whatever?

Grateful for any advice - max

SOLUTION:
I actually just solved this - i uninstalled the rdp-rb-readline gem, then did gem install rb-readline, then added gem 'rb-readline' to my app's Gemfile. I guess it just needed to know where to look for the readline stuff if it wasn't in the usual place. I didn't need to do anything with extconf.rb, which is good because the rb-readline gem doesn't have one.

I've left this at the end of my question because a) someone else might have a better understanding of the problem rather than my trial and error approach and b) in case anyone else has the same problem.

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

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

发布评论

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

评论(2

﹏雨一样淡蓝的深情 2024-11-04 06:09:52

如果您使用 rvm,您始终可以使用软件包安装程序工具来修复您的操作系统可能存在的任何问题。 Ruby 经常使用与您安装的库稍有不同的库:

rvm package install readline

rvm 安装程序针对特定的、已知工作版本的 readline 应用多个补丁,并且构建应该不会出现问题。此 readline 包不会影响您的系统安装,并且仅用于基于 rvm 的构建。

If you're using rvm, you can always make use of the package installer facility to fix any issues your OS may have. Ruby often uses libraries that are a bit different from what you have installed:

rvm package install readline

The rvm installer applies several patches against a specific, known-working version of readline and should build without issues. This readline package won't affect your system install, and is used only for rvm-based builds.

寒尘 2024-11-04 06:09:52
cd ~/.rvm/src/ruby-X.X.X-pXXX/ext/readline

(将 ruby​​-1.9.2-p180 替换为您的系统 ruby​​ 版本)

ruby extconf.rb

如果任何检查都显示“否”,请安装这些软件包:

sudo apt-get install libncurses5-dev libreadline5-dev

并运行 ruby​​ extconf.rb ,

您应该得到所有检查“是”,

make
make install

现在它可以工作了。

cd ~/.rvm/src/ruby-X.X.X-pXXX/ext/readline

(replace ruby-1.9.2-p180 with your system ruby version)

ruby extconf.rb

if any checking says no, install these pakages:

sudo apt-get install libncurses5-dev libreadline5-dev

and run ruby extconf.rb

you should get all checking yes,

make
make install

now it will work.

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