Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Building Ruby 2.x on OS X Mavericks Suddenly Fails #550

Closed
nikolay opened this Issue · 59 comments
@nikolay
Last 10 log lines:
compiling ossl_x509ext.c
1 warning generated.
compiling ossl_x509name.c
compiling ossl_x509req.c
compiling ossl_x509revoked.c
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
ld: warning: directory not found for option '-L/usr/local/var/rbenv/versions/2.0.0-p451/lib'
make: *** [build-ext] Error 2
@nikolay

2.1.1 doesn't build either:

Last 10 log lines:
1 warning generated.
compiling ossl_x509ext.c
compiling ossl_x509name.c
compiling ossl_x509req.c
compiling ossl_x509revoked.c
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
@shanesveller

I'm seeing this also. 1.9.3-p484 compiles fine. I ran several homebrew updates this morning, and I have rbenv and ruby-build themselves installed via homebrew as well, so I'm looking suspiciously towards what I updated. Here are some of the relevant logs/output:

brew doctor shows no warnings. I'm on OSX 10.9.2 with Xcode 5.1.1 on a "Late 2013" 15-inch MBP. Please let me know if I can provide any more information that would assist.

Of mild interest is that rvm 1.25.22 can build the same two Ruby versions successfully. I don't want to use rvm and do not plan to do so, but it does suggest that it may be something specific to how ruby-build does its dependencies and compilation compared to rvm's method.

@mislav
Collaborator

Really bizarre failures. Does a successful xcode-select --install change anything?

@nikolay

@mislav It does not for me.

@willrax

I was having the same issue. For what it's worth installing manually from source worked fine for me.

./configure --prefix=/Users/willrax/.rbenv/versions/2.1.1/ --with-openssl-dir=/usr/local/opt/openssl
@shanesveller

@mislav xcode-select also does not change anything for me.

@keith

I'm seeing this exact error as well with p451 and p353. I reinstalled the command line tools just to make sure but it's still giving me this error.

@mislav
Collaborator

Can't reproduce on Mavericks with latest Command Line tools, ruby-build and openssl from Homebrew :crying_cat_face:

@keith

I also got the same error @nikolay got for 2.1.1 on 2.0.0-p247

@nikolay

2.0.0-p353 doesn't work either. I have the latest Command Line Tools from Xcode 5.1.1 (5B008) and latest Homebrew OpenSSL 1.0.1g (linked or not - it doesn't matter).

@mislav mislav referenced this issue in sstephenson/rbenv
Closed

Ruby 2.1.1 build failed on Mavericks #579

@keith

Found some other info with similar looking errors here and here but their configuration didn't work for me either.

@nikolay

@Keithbsmiley I tried those yesterday, too, but with no luck similarly to you.

@nikolay nikolay changed the title from Building Ruby 2.0.0-p451 on OS X Mavericks Suddenly Fails to Building Ruby 2.x on OS X Mavericks Suddenly Fails
@Trevoke

Running into the exact same issue here, too. A friend and I are in the same predicament. I installed 2.1.1 and 2.1.0 a few weeks ago and it worked fine, but not today.

@nikolay

@Trevoke Everything was working on Sunday. Something broke yesterday.

@Trevoke

It looks like the problem is readline 6.3. Looking further into it now.

@keith

I tried to install the version of readline from homebrew 2 days ago but the source 404'd.

@thomasjo

Homebrew's readline got upgraded two days ago:
Homebrew/homebrew@1294240

@Trevoke

I'm checking out this issue: #526

I am looking for a readline patch for 2.1.1 which I can apply.

@shanesveller

Downgrading readline to the version @Keithbsmiley linked with a straightforward brew uninstall readline && brew install $RAW_URL did the trick for me for both 2.0.0-p451 and 2.1.1. Huzzah!

@keith

Oh readline... Hopefully someone can find and submit a patch to fix this issue with Homebrew?

@mislav
Collaborator

Nice find, @Trevoke. Homebrew's readline is automatically slurped in per 94c15a5, and Ruby doesn't seem to play well with readline 6.3

@keith

@mislav does that make this plugin unnecessary? (it looks like it does)

@Trevoke

@Keithbsmiley the first line of the README, "This plugin's behavior has been made standard in ruby-build, rendering it obsolete." makes me think that it is indeed the case :)

@Trevoke

So now the question is .. Where can we find a patch for Ruby 2.x that plays nice with readline 6.3 ? I don't understand readline well enough to do it :/

@keith

Haha ouch my bad, I just snagged the link from the clone in my dotfiles, haven't looked at the page in ages.

@salex

I'm trying to set up a debian box as a rails server, coming from osx, its been a little challenge. I am also running into a readline problem, this was after an openssl problem. getting error:

    compiling readline.c
    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)
     ^
    make[2]: *** [readline.o] Error 1

There is a revision for 2.1.1 (also had error trying 2.1.0) https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45488.

I modified the file in the /tmp directory and got it to compile, but have no idea how to make install to my .rbenv directory

@nikolay

For now, the solution is:

brew uninstall readline
brew install https://raw.githubusercontent.com/Homebrew/homebrew/0181c8a1633353affefabe257c170edbd6d7c008/Library/Formula/readline.rb
brew pin readline
@hackjoy

@nikolay Following your steps allowed me to install 2.1.1. Previously I was getting the same log that you posted

@hendricius

@nikolay thanks that worked

@supert56

@nikolay Thanks for this, it's also worked for me o 2.0.0-p247 :)

@nikolay

@hackjoy @hendricius @supert56 Yeah, works for now by pinning readline... until the better times come. :smile:

@pearofducks pearofducks referenced this issue in postmodern/ruby-install
Closed

Readline 6.3 and Ruby on OSX #144

@tiredpixel

I experienced this also with Ruby 2.0.0-p353:

Last 10 log lines:
1 warning generated.
compiling ossl_x509ext.c
compiling ossl_x509name.c
compiling ossl_x509req.c
compiling ossl_x509revoked.c
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2

Reinstalling readline and pinning as described by @nikolay worked (#550 (comment)). Thanks! :)

OS X 10.9.2
OpenSSL 0.9.8y 5 Feb 2013 (darwin64-x86_64-llvm) (/System/Library/OpenSSL)
xcode-select version 2333.
xcode-select -p (/Applications/Xcode.app/Contents/Developer)
brew 0.9.5
rbenv 0.4.0
ruby-build 20140408

Peace,
tiredpixel

@FeipingHunag

Install homebrew

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
$ echo export PATH="/usr/local/bin:$PATH" >> ~/.zprofile

Check homebrew

$ brew doctor

Install ruby 2.1.1

$ brew update
$ brew uninstall openssl && brew install openssl

readline 6.3.3 should be uninstalled, and install readline 6.2.4

$ brew uninstall readline
$ cd /usr/local/
$ git checkout 0181c8a Library/Formula/readline.rb
$ brew install readline

$ RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.1.1

$ rbenv versions

@diek

When this err happened I thought I had done something dumb. Anyways, nope. @nikolay thanks that worked perfectly. Thanks,
derrick

@mortik

Which rbenv and ruby-build versions do you use? rbenv und ruby-build are failing on my mac when i use readline 6.2.4

dyld: Symbol not found: _rl_executing_keyseq
  Referenced from: /usr/local/bin/bash
  Expected in: /usr/local/opt/readline/lib/libreadline.6.dylib
 in /usr/local/bin/bash
Trace/BPT trap: 5
@ladislas

same issue as @mortik...

@Trevoke

Note! @mislav wrote a patch for 2.1.1 which works, you can find it here:
#526 (comment)

curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1

@lukehorvat

Thanks @FeipingHunag, switching from readline 6.3.3 to 6.2.4 (using Homebrew) worked for me. (rbenv 0.4.0)

@kylemclaren

The readline fix worked for me...

@CalderWishne

Same issue as @mortik. Tried janson's unlink && link trick here
Homebrew/homebrew#23424

@CalderWishne

...but no dice

@jcapron

Nice find @Trevoke! :+1:

I had the same issue, switching from readline 6.3 to 6.2 using this raw URL fixed it

$ brew uninstall readline && brew install https://raw.githubusercontent.com/Homebrew/homebrew/0181c8a1633353affefabe257c170edbd6d7c008/Library/Formula/readline.rb
@lsmolic

+9001, readline fix works for me

@keith keith referenced this issue in codahale/bcrypt-ruby
Open

Compilation error on Mavericks #92

@windvalleyman

readline fix works for me too!

@bkuhlmann bkuhlmann referenced this issue from a commit in bkuhlmann/osx
Brooke Kuhlmann Added the [Readline](http://tiswww.case.edu/php/chet/readline/rltop.html
) Homebrew install.

* Currently locked at Readline 6.2.4 per this [rbenv issue](sstephenson/ruby-build#550).
2d9a046
@mboersma mboersma referenced this issue in deis/deis
Merged

feat(test): add integration tests #837

@nicholsn

+1 for the readline fix

@eitch

I have the same problem. On a fresh OSX installation, i can't install ruby 2.0.0-p451 because readline gives problems. Using the 2.2.x version worked at some point, but now that too fails.

@emilford

I'm in the same boat as @eitch. The readline fix does not work for me and my ruby 2.x are failing.

@emilford

Nevermind. I checked brew list readline and there were still references to 6.3.3. I tried brew uninstall readline again and brew list readline references 6.2.4. With that, the ruby build was successful. Thanks.

@eitch

The weird thing now is, that if i have readline 6.2.4 installed and
then run rbenv, i get the following error:

    dyld: Symbol not found: _rl_executing_keyseq
      Referenced from: /usr/local/bin/bash
      Expected in: /usr/local/opt/readline/lib/libreadline.6.dylib
     in /usr/local/bin/bash
    Trace/BPT trap: 5

But if i then again install readline 6.3.3 i don't have the problem,
but rbenv install 2.0.0-p451 fails:

    compiling readline.c
    linking shared-object bigdecimal.bundle
    compiling ripper.c
    readline.c:254:28: warning: '&&' within '||' [-Wlogical-op-parentheses]
                        else if (!('0' <= *s && *s <= '9' || *s == ';')) {
                                   ~~~~~~~~~~^~~~~~~~~~~~ ~~
    readline.c:254:28: note: place parentheses around the '&&' expression to silence this warning
                        else if (!('0' <= *s && *s <= '9' || *s == ';')) {
                                             ^
                                   (                     )
    readline.c:1886:26: error: use of undeclared identifier 'Function'
        rl_pre_input_hook = (Function *)readline_pre_input_hook;
                             ^
    readline.c:1886:36: error: expected expression
        rl_pre_input_hook = (Function *)readline_pre_input_hook;
                                       ^
    1 warning and 2 errors generated.
    make[2]: *** [readline.o] Error 1
    make[1]: *** [ext/readline/all] Error 2

Any ideas?

@buckleytom

same problem as @eitch here

@ingemar

Downgrading to readline 6.2.4 worked for me.

@baroldgene

Just a note that the pinning was key. I did brew uninstall readline which then showed my readline version to be 6.2.4. However after a few minutes I did another brew list readline and the version was again 6.3.3. I had to do brew uninstall readline followed by brew pin readline to get it to stay and thus the ruby 2.1 install to work.

@hsbt
Collaborator

Please update latest version of ruby-build, and build latest version of Ruby.

@hsbt hsbt closed this
@jonathangwilliams

I fixed this problem by deleting non-system ruby files, changing my command line tools to 5.0 in Xcode > Preferences > Locations and then running Bundle Install again. Command line tools can be changed back to 5.1.1 after installation succeeds.

@ABorovenskiy

I had this issue and fixed it by reinstalling openssl library

@drlube

This worked:

brew uninstall readline && brew install readline 

It replaced my readline version 3.3.3 with version 3.3.6 and allowed me to use rbenv to install 2.0.0 p147.

@aguspagnoni

thanks @nikolay the readline fixed it!

@jaredhabeck

I just feel bad you ruby-build guys have to be plagued by comments like this (even though they are amazingly helpful) when it's an upstream ruby/openssl/readline issue! Thanks for all you do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.