ruby-build: Build failure on 2.x and solution (related to readline)

It seems recent versions of ruby (2.x) have a hard time with readline and fail to build on many systems. The error typically being:

Installing ruby-2.1.0...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20140317220101.16966
Results logged to /tmp/ruby-build.20140317220101.16966.log

Last 10 log lines:
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
installing default ripper libraries
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory '/tmp/ruby-build.20140317220101.16966/ruby-2.1.0/ext/openssl'
linking shared-object ripper.so
make[2]: Leaving directory '/tmp/ruby-build.20140317220101.16966/ruby-2.1.0/ext/ripper'
make[1]: Leaving directory '/tmp/ruby-build.20140317220101.16966/ruby-2.1.0'
uncommon.mk:180: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2

While it looks like openssl error upon viewing the build log the actual culprit is readline:

make[2]: Entering directory '/tmp/ruby-build.20140317220101.16966/ruby-2.1.0/ext/ripper'
compiling ripper.c
installing default cparse libraries
linking shared-object racc/cparse.so
readline.c: In function ‘Init_readline’:
readline.c:1977:26: error: ‘Function’ undeclared (first use in this function)
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                          ^
readline.c:1977:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1977:36: error: expected expression before ‘)’ token
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                                    ^
readline.c: At top level:
readline.c:634:1: warning: ‘readline_pre_input_hook’ defined but not used [-Wunused-function]
 readline_pre_input_hook(void)
 ^
Makefile:228: recipe for target 'readline.o' failed
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20140317220101.16966/ruby-2.1.0/ext/readline'
exts.mk:198: recipe for target 'ext/readline/all' failed
make[1]: *** [ext/readline/all] Error 2

I found the following allows ruby 2.0 variants including 2.1.0 and 2.1.1 to build successfully:

RUBY_CONFIGURE_OPTS=--with-readline-dir="/usr/lib/libreadline.so" rbenv install 2.1.1

The above worked on Arch Linux and likely works on many systems with readline installed in /usr/lib/libreadline.so and more generally /some/prefix/libreadline.so

Perhaps you can update the README to cover this error and the solution because there was precious little information on overcoming this problem that I could find.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 54 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Are you serious closing the issue like that? Yes it is a ruby-build issue!

I would have expected you would help users to actually succeed with ruby-build as it is NOT possible to build on many systems RIGHT NOW. I burnt a lot of time figuring out how to get it to work and no doubt others just give up and you never hear about it.

A simple heads up in your readme as you do for Mac would save people a lot of time for a current problem using your tool to achieve the goal of building ruby. It sounds like you would rather have users waste their time scratching their heads. Why then would I use ruby-build? Where is the value add?

Yes I can see there is a patch on trunk which may help with a particular readline issue but that doesn’t help me or others use ruby-build to get a functioning ruby 2.0.x or 2.1.x today.

Why then would I use ruby-build? Where is the value add?

@ahacking I’d like to offer you a 100% refund for your troubles.

ruby-build is a community project. I’m sorry you had some trouble getting it working. If you read the LICENSE it says—nay, it screams:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

To answer your question directly: the value that ruby-build provides is that you didn’t have to build your own Ruby build tool from scratch. You’re welcome.

I’ve done all I’m going to do, if you can’t be bothered to paste my solution into your readme then the last thing I want to do is to tweak your wording and go back and forth and have a mini bikeshed over it until you get the exact wording you could have written.

I won’t be using ruby-build moving forward as there is no value in it because the maintainers clearly don’t care about their users. If you don’t care then why the fsck should I ?

I use like to use tools that actually give me something. On Mar 18, 2014 12:21 AM, “Erik Michaels-Ober” notifications@github.com wrote:

A simple heads up in your readme as you do for Mac would save people a lot of time for a current problem using your tool to achieve the goal of building ruby.

@ahacking https://github.com/ahacking This patch would be a welcome addition. Thank you for volunteering to contribute it.

Reply to this email directly or view it on GitHubhttps://github.com/sstephenson/ruby-build/issues/526#issuecomment-37820404 .

I’ve got a patch for 2.0.0-p451:

curl -fsSL https://gist.github.com/EdVanDance/9738787.txt | rbenv install --patch 2.0.0-p451

If you just want to get Ruby 2.0.0-p353 working without upgrading the patch version have a look here: https://github.com/rbenv/ruby-build/issues/587#issuecomment-374756360.

I already requested to support readline-6.3 to ruby-core. this issue isn’t ruby-build issue.

ref. https://bugs.ruby-lang.org/issues/9630