在没有 rvm 或 rbenv 的情况下编译 Ruby 2.0 错误,`readline.c:1886:26: error: 'Function' undeclared (first use in this function)` [英] compile Ruby 2.0 errors without rvm or rbenv , `readline.c:1886:26: error: 'Function' undeclared (first use in this function)`

查看:30
本文介绍了在没有 rvm 或 rbenv 的情况下编译 Ruby 2.0 错误,`readline.c:1886:26: error: 'Function' undeclared (first use in this function)`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要安装 gitlab,不推荐使用任何 ruby​​ 版本管理器.但是

I want to install gitlab, which don't recommend to use any ruby version manager. But

这是我的操作系统 Linux dqa-dev 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux

linking shared-object psych.so
installing default psych libraries
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/psych'
make[2]: Entering directory `/home/poc/ruby-2.0.0-p451/ext/pty'
compiling pty.c
pty.c: In function 'chfunc':
pty.c:143:12: warning: ignoring return value of 'seteuid', declared with attribute warn_unused_result [-Wunused-result]
     seteuid(getuid());
            ^
linking shared-object pty.so
installing default pty libraries
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/pty'
make[2]: Entering directory `/home/poc/ruby-2.0.0-p451/ext/racc/cparse'
compiling cparse.c
linking shared-object racc/cparse.so
installing default cparse libraries
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/racc/cparse'
make[2]: Entering directory `/home/poc/ruby-2.0.0-p451/ext/readline'
compiling readline.c
readline.c: In function 'Init_readline':
readline.c:1886:26: error: 'Function' undeclared (first use in this function)
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                          ^
readline.c:1886:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1886:36: error: expected expression before ')' token
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                                    ^
readline.c: At top level:
readline.c:530:1: warning: 'readline_pre_input_hook' defined but not used [-Wunused-function]
 readline_pre_input_hook(void)
 ^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory `/home/poc/ruby-2.0.0-p451/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory `/home/poc/ruby-2.0.0-p451'
make: *** [build-ext] Error 2

推荐答案

我也有 Ubuntu 14.04,我必须让它工作.分享我所做的,以防万一它对你有用.

I also have Ubuntu 14.04 and I got to make it work. Sharing what I did just in case it works for you.

我修补了文件 ext/readline/readline.c 替换了 1886 行:

I patched the file ext/readline/readline.c replacing line 1886:

rl_pre_input_hook = (Function *)readline_pre_input_hook;

rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;

然后我试着再做一次,它奏效了.

Then I tried to make it again and it worked.

来源:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741825

这篇关于在没有 rvm 或 rbenv 的情况下编译 Ruby 2.0 错误,`readline.c:1886:26: error: 'Function' undeclared (first use in this function)`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆