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

Ruby 2.1.1 build failed on Mavericks #579

Closed
vincenzomerolla opened this Issue Apr 15, 2014 · 40 comments

Comments

Projects
None yet
@vincenzomerolla

vincenzomerolla commented Apr 15, 2014

Hey,

I'm having trouble installing Ruby 2.1.1 on my iMac running OSX 10.9.2 (Mavericks). Can someone identify the issue from my log?

$ rbenv install 2.1.1
Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/ft/wdkgq_yx5r91dwfm9mbcyyxw0000gn/T/ruby-build.20140415004206.96361
Results logged to /var/folders/ft/wdkgq_yx5r91dwfm9mbcyyxw0000gn/T/ruby-build.20140415004206.96361.log
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
@woeldiche

This comment has been minimized.

woeldiche commented Apr 15, 2014

I get the same error trying to install 2.1.1 or 2.1.0 with rbenv. First it failed trying to link openssl, then I installed it manually with homebrew and now it fails on linking ripper instead.

@mislav mislav changed the title from Ruby 2.1.1 Build Failed to Ruby 2.1.1 build failed on Mavericks Apr 15, 2014

@mislav

This comment has been minimized.

Member

mislav commented Apr 15, 2014

See rbenv/ruby-build#550

I don't know the cause yet 😿

@alwillis

This comment has been minimized.

alwillis commented Apr 15, 2014

Ditto on the error; even on a freshly installed Mavericks install no less.

@orospakr

This comment has been minimized.

orospakr commented Apr 16, 2014

I worked around this by uninstalling my homebrew readline package. Apparently GNU Readline 6.3 is ABI incompatible with what Ruby currently expects. Same results with either 2.1.0 or 2.1.1. Upstream apparently has a fix: https://bugs.ruby-lang.org/issues/9578. However, I did not have success trying to massage their patches into working with --patch, so I went with the route of uninstalling GNU readline and leaving only OSX's built-in editline wrapper in place.

However, I got over that hurdle only to stumble into an apparent resurgence of rbenv/ruby-build#377: ruby-build isn't noticing my brew-installed copy of OpenSSL 1.0.1g. Not been a good week to install Ruby on a Mac, apparently. Anyone else run into this after working around the readline error?

@arvsr1988

This comment has been minimized.

arvsr1988 commented Apr 22, 2014

what @orospakr suggested fixed the problem.

@andersennl

This comment has been minimized.

andersennl commented Apr 22, 2014

I've got the same error, tried to install ruby 2.1.0 via rbenv today.

@aaronadamsTO

This comment has been minimized.

aaronadamsTO commented Apr 23, 2014

I had too many dependencies to completely uninstall the Homebrew readline package, but here's a quick and easy workaround that worked for me (from rbenv/ruby-build#550 (comment)):

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

Edit: This is fixed in Ruby 2.1.2, use it instead!

@chrsvl

This comment has been minimized.

chrsvl commented Apr 23, 2014

@aaronadamsTO thanks, it worked!

@juanazam

This comment has been minimized.

juanazam commented Apr 23, 2014

Applying this patch its another possible workaround.

@thommahoney

This comment has been minimized.

thommahoney commented Apr 24, 2014

@juanazam thank you. The patch is the best solution at this time.

@andschwa

This comment has been minimized.

andschwa commented Apr 27, 2014

@juanazam 👍 Thanks man!

@andschwa

This comment has been minimized.

andschwa commented Apr 27, 2014

If anyone else is using rbenv and wants a patched install of either 2.1.1 or 2.0.0-p451 (which is having the same issue), here's a post on it.

@alwillis

This comment has been minimized.

alwillis commented Apr 27, 2014

@andschwa Thanks for posting this; works great.

@mattbrewer

This comment has been minimized.

mattbrewer commented Apr 28, 2014

@andschwa Thanks for the post, worked great!

@andschwa

This comment has been minimized.

andschwa commented Apr 28, 2014

No problem!

@nikhilbhardwaj

This comment has been minimized.

nikhilbhardwaj commented Apr 29, 2014

@aaronadamsTO Thanks it worked for me.

@negibouze

This comment has been minimized.

negibouze commented Apr 29, 2014

@andschwa Thanks for posting this; works great!

@gregclar

This comment has been minimized.

gregclar commented May 2, 2014

@andschwa. Thanks for the post - worked great.

@jclark42796

This comment has been minimized.

jclark42796 commented May 2, 2014

@aaronadamsTO worked for me, thanks!

@brobertsaz

This comment has been minimized.

brobertsaz commented May 27, 2014

@aaronadamsTO Thanks it worked for me as well!!

@aaronadamsTO

This comment has been minimized.

aaronadamsTO commented May 27, 2014

Note that this issue was fixed in Ruby 2.1.2.

@andschwa

This comment has been minimized.

andschwa commented May 27, 2014

Can concur with @aaronadamsTO. The issue is fixed.

@sc0ttman

This comment has been minimized.

sc0ttman commented Jul 1, 2014

+1 for readline fix

@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

I also try the readline fix, but for me it doesn't work :(

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

@aaronadamsTO

This comment has been minimized.

aaronadamsTO commented Jul 29, 2014

Again, please note that this issue was fixed in Ruby 2.1.2 and up. The patch above is no longer necessary.

@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

So, it works when I install the latest version of Ruby?
I also need to install with rbenv ruby version 1.9.3-p194
So I do rbenv install 1.9.3-p194
Than I also get an Build Failed error message :(

@aaronadamsTO

This comment has been minimized.

aaronadamsTO commented Jul 29, 2014

It's possible you've got multiple versions of readline installed, and that rbenv is still looking at a newer one. Try this:

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

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

Yes, I have execute your terminal commands, but nothing works :(

| => rbenv install 1.9.3-p194
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /Users/Remzi/.rbenv/versions/1.9.3-p194

Downloading ruby-1.9.3-p194.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/46e2fa80be7efed51bd9cdc529d1fe22ebc7567ee0f91db4ab855438cf4bd8bb
Installing ruby-1.9.3-p194...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/zw/064_dxn92d5czpzx1ckslvzc0000gn/T/ruby-build.20140729171306.65724
Results logged to /var/folders/zw/064_dxn92d5czpzx1ckslvzc0000gn/T/ruby-build.20140729171306.65724.log

Last 10 log lines:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/openssl/x509_vfy.h:465:6: note: 'X509_STORE_CTX_set_time' declared here
void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
     ^
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
installing default openssl libraries
installing default ripper libraries
39 warnings generated.
linking shared-object openssl.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

Also updated Ruby Build:

Downloading ruby-1.9.3-p194.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/46e2fa80be7efed51bd9cdc529d1fe22ebc7567ee0f91db4ab855438cf4bd8bb
Installing ruby-1.9.3-p194...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/zw/064_dxn92d5czpzx1ckslvzc0000gn/T/ruby-build.20140729173159.16356
Results logged to /var/folders/zw/064_dxn92d5czpzx1ckslvzc0000gn/T/ruby-build.20140729173159.16356.log

Last 10 log lines:
compiling token.c
compiling yaml2byte.c
linking shared-object socket.bundle
ld: warning: directory not found for option '-L/Users/Remzi/.rbenv/versions/1.9.3-p194/lib'
installing default syck libraries
linking shared-object syck.bundle
ld: warning: directory not found for option '-L/Users/Remzi/.rbenv/versions/1.9.3-p194/lib'
linking shared-object ripper.bundle
ld: warning: directory not found for option '-L/Users/Remzi/.rbenv/versions/1.9.3-p194/lib'
make: *** [build-ext] Error 2
@mislav

This comment has been minimized.

Member

mislav commented Jul 29, 2014

@remzicavdar You might not have a problem with readline, but with openssl. Try brew unlink openssl #542 (comment)

@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

I have used the OpenSSL installer.
This is a home project I'm working on :)

https://github.com/remzicavdar/OpenSSL-Universal-Binary-Installer

@mislav

This comment has been minimized.

Member

mislav commented Jul 29, 2014

@remzicavdar OK, then please uninstall it. Many software on OS X like Ruby 1.9 will fail when compiled against newer openssl versions. Openssl that ships with OS X will be just fine for most software, and those Rubies that need the newer one will automatically install it through ruby-build (or re-use the one available in Homebrew)

@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

#!/usr/bin/env bash
set -x
trap read debug

OPENSSL_VERSION="1.0.1h"

cd /usr/local/src
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz

tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
cd openssl-$OPENSSL_VERSION


sudo ./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-$OPENSSL_VERSION
sudo make
sudo make install


ln -s openssl-$OPENSSL_VERSION /usr/local/openssl


echo 'export PATH=/usr/local/openssl/bin:$PATH' >> ~/.bash_profile
echo 'export MANPATH=/usr/local/openssl/ssl/man:$MANPATH' >> ~/.bash_profile


source ~/.bash_profile


sudo security find-certificate -a -p /Library/Keychains/System.keychain > /usr/local/openssl/ssl/cert.pem

sudo security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> /usr/local/openssl/ssl/cert.pem

cd /usr/local/src
sudo rm openssl-$OPENSSL_VERSION.tar.gz
sudo rm -rf openssl-$OPENSSL_VERSION
@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

What do I need to uninstall? The latest version of OpenSSL?
I think it's safer and before I installed the latest version of OpenSSL I already got the Build Failed error :(

@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

| => brew unlink openssl
Unlinking /usr/local/Cellar/openssl/1.0.1h... 0 symlinks removed

It was linked to my version?

@mislav

This comment has been minimized.

Member

mislav commented Jul 29, 2014

On Tue, Jul 29, 2014 at 8:59 AM, Remzi Cavdar notifications@github.com
wrote:

What do I need to uninstall? The latest version of OpenSSL?
I think it's safer and before I installed the latest version of OpenSSL I
already got the Build Failed error :(

Yes the latest version of OpenSSL. Ruby 1.9 won't compile against it.

It's just a thing to try, though. If it doesn't fix your problem, then it
must be something else.

@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

Okay, I will try it :)

And if I run brew doctor I get the following warnings :(

| => brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libruby.2.1.0.dylib

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/ruby-2.1.pc
    /usr/local/lib/pkgconfig/ruby-2.2.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
    /usr/local/lib/libruby-static.a
    /usr/local/lib/libruby.2.1.0-static.a

Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
    /sw/bin/    /usr/local/    /usr/local/bin/
@Remzi1993

This comment has been minimized.

Remzi1993 commented Jul 29, 2014

Also compiling Ruby from source doesn't work either :(

cd /usr/local/src
git clone git://github.com/ruby/ruby.git
cd ruby
autoconf
./configure
make
make check
sudo make install

sudo rm -rf /usr/local/src/*

I just want to install Ruby, Rails and work on a project, but know I'm really struck :(

@mislav

This comment has been minimized.

Member

mislav commented Sep 3, 2014

Something seems really broken with your development environment, @remzicavdar. You could try resolving all the issues that brew doctor is complaining about by removing the offending files. You should ensure that the only which -a openssl is /usr/bin/openssl and that it's the system default version ("OpenSSL 0.9.8y"). You should brew install openssl but NOT brew link --force openssl. In the end, try installing only Ruby 2.1.2 and none of the older Ruby versions since they might not be compatible with newest version of libyaml from Homebrew. We're working on fixing compiling old releases.

@mislav

This comment has been minimized.

Member

mislav commented Sep 3, 2014

Also please reopen new issues about this in the ruby-build project, as this project (rbenv) doesn't deal directly with compiling Ruby versions.

@mislav mislav closed this Sep 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment