Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nikolay opened this issue Apr 14, 2014 · 59 comments
Closed

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

nikolay opened this issue Apr 14, 2014 · 59 comments

Comments

@nikolay
Copy link

nikolay commented Apr 14, 2014

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
Copy link
Author

nikolay commented Apr 14, 2014

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
Copy link

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
Copy link
Member

mislav commented Apr 15, 2014

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

@nikolay
Copy link
Author

nikolay commented Apr 15, 2014

@mislav It does not for me.

@willrax
Copy link

willrax commented Apr 15, 2014

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
Copy link

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

@keith
Copy link

keith commented Apr 15, 2014

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
Copy link
Member

mislav commented Apr 15, 2014

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

@keith
Copy link

keith commented Apr 15, 2014

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

@nikolay
Copy link
Author

nikolay commented Apr 15, 2014

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).

@keith
Copy link

keith commented Apr 15, 2014

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

@nikolay
Copy link
Author

nikolay commented Apr 15, 2014

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

@nikolay nikolay changed the title Building Ruby 2.0.0-p451 on OS X Mavericks Suddenly Fails Building Ruby 2.x on OS X Mavericks Suddenly Fails Apr 15, 2014
@Trevoke
Copy link

Trevoke commented Apr 15, 2014

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
Copy link
Author

nikolay commented Apr 15, 2014

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

@Trevoke
Copy link

Trevoke commented Apr 15, 2014

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

@keith
Copy link

keith commented Apr 15, 2014

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

@thomasjo
Copy link
Contributor

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

@Trevoke
Copy link

Trevoke commented Apr 15, 2014

I'm checking out this issue: #526

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

@keith
Copy link

keith commented Apr 15, 2014

Here's a raw URL from before the 6.3.3 upgrade. (version 6.2.4) https://raw.githubusercontent.com/Homebrew/homebrew/0181c8a1633353affefabe257c170edbd6d7c008/Library/Formula/readline.rb

@shanesveller
Copy link

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
Copy link

keith commented Apr 15, 2014

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

@mislav
Copy link
Member

mislav commented Apr 15, 2014

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
Copy link

keith commented Apr 15, 2014

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

@Trevoke
Copy link

Trevoke commented Apr 15, 2014

@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
Copy link

Trevoke commented Apr 15, 2014

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
Copy link

keith commented Apr 15, 2014

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

@salex
Copy link

salex commented Apr 16, 2014

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
Copy link
Author

nikolay commented Apr 17, 2014

For now, the solution is:

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

@Trevoke
Copy link

Trevoke commented Apr 22, 2014

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
Copy link
Contributor

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

@kylemclaren
Copy link

The readline fix worked for me...

@CalderWishne
Copy link

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

@CalderWishne
Copy link

...but no dice

@jcapron
Copy link

jcapron commented Apr 23, 2014

Nice find @Trevoke! 👍

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
Copy link

lsmolic commented Apr 26, 2014

+9001, readline fix works for me

@windvalleyman
Copy link

readline fix works for me too!

@nicholsn
Copy link

+1 for the readline fix

@eitch
Copy link

eitch commented May 5, 2014

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
Copy link

emilford commented May 5, 2014

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

@emilford
Copy link

emilford commented May 5, 2014

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
Copy link

eitch commented May 5, 2014

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?

@tbuckl
Copy link

tbuckl commented May 5, 2014

same problem as @eitch here

@ingemar
Copy link

ingemar commented May 6, 2014

Downgrading to readline 6.2.4 worked for me.

@baroldgene
Copy link

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
Copy link
Member

hsbt commented May 9, 2014

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

@hsbt hsbt closed this as completed May 9, 2014
@jonathangwilliams
Copy link

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.

@ABorovenskyi
Copy link

I had this issue and fixed it by reinstalling openssl library

@drlube
Copy link

drlube commented Jul 9, 2014

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
Copy link

thanks @nikolay the readline fixed it!

@jaredhabeck
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests