10

我想安装 gitlab,不建议使用任何 ruby​​ 版本管理器。但

这是我的操作系统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
4

4 回答 4

39

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

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

rl_pre_input_hook = (Function *)readline_pre_input_hook;

rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;

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

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

于 2014-06-01T19:49:21.103 回答
3

我在尝试使用 rbenv 安装 ruby​​-2.0.0-p247 时也遇到了这个问题。使用这个补丁可以节省一些时间。

你可以像这样运行它:

curl -fsSL https://gist.github.com/ference/d3d4cbbe18309a91ad9b/raw/267ea89fa145c536967831e1af4dea030297b53e/ruby-2.0.0-p247.patch | rbenv install --patch 2.0.0-p247
于 2015-11-23T16:03:00.463 回答
2

这是我在 Ubuntu 14.04 服务器版上的解决方案。

我需要安装下划线

sudo apt-get install libreadline6 libreadline6-dev

然后,问题就解决了。

于 2014-05-08T01:37:11.330 回答
-3

从https://github.com/sstephenson/ruby-build/issues/690找到了解决方案。实际上缺少的是 libffi-dev。我在 Ubuntu 12.04 上尝试过,它是成功的。

sudo apt-get install libffi-dev
于 2015-04-06T06:28:02.263 回答