rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 779 forks source link

OpenSSL 1.0.1e downloaded via ruby-build fails to build on OSX 10.8.2 #305

Closed davidcelis closed 11 years ago

davidcelis commented 11 years ago

My installations of XCode and the command line tools are all up-to-date, as is my version of Mountain Lion. Normally, I would install Ruby as such:

CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p0

But the version definition of 2.0.0-p0 also downloads OpenSSL 1.0.1e, which I have already installed via homebrew. I did manage to get 2.0.0-p0 to build by swapping out CONFIGURE_OPTS with RUBY_CONFIGURE_OPTS. Here is a build failure log

It appears that the configuration is not being called correctly. But perhaps since this OpenSSL installation is only ever attempted for Mac OS X, this method should check to see if a valid and working version has already been installed via homebrew? Then again, I would love for ruby-build's installation to pass locally. I ran into issues bundling via https and found out that OpenSSL on Mac apparently stopped including certificate files. I had to wire up SSL certs manually and now have an SSL_CERT_FILE environment variable floating around my shell configuration.

sferik commented 11 years ago

I’m also on OS X 10.8.2, Xcode 4.6, clang 4.2, gcc 4.2.1, with openssl 1.0.1e installed via homebrew and I can’t reproduce this issue.

Does it work if you don’t set CONFIGURE_OPTS?

There was some homebrew-aware code in #273 but that was ultimately removed with the comment:

Killed the Homebrew support. Scope creep with dubious aesthetics.

However, given this issue and #304 perhaps @jeremy and @sstephenson would be willing to revisit that decision?

I don’t particularly want ruby-build coupled to homebrew, however, I believe it’s the most common ruby-build installation method, so I think it’s important that the two system play nice.

rmoriz commented 11 years ago

for me this problem happens only when CONFIGURE_OPTS is set, probably the options are passed to openssl which of course can't handle it…?

logs: https://gist.github.com/rmoriz/8a67544c95569d7ab3e9

wfarr commented 11 years ago

@sferik I think it's something funky going on with Homebrew-induced behavior.

My system matches yours, except:

Reviewing the build log, OpenSSL builds fine, but Ruby throws out a warning at configure-time:

/tmp/ruby-build.20130225092018.48825/ruby-2.0.0-p0 /tmp/ruby-build.20130225092018.48825 /opt/boxen/rbenv/versions
configure: WARNING: unrecognized options: --with-openssl-dir

I'm guessing something in your setup is causing the configure script to find openssl installed via homebrew anyway, and just outright not utilizing the openssl pulled down by ruby-build.

davidcelis commented 11 years ago

@rmoriz seems to be right. CONFIGURE_OPTS usage is what is breaking the OpenSSL build. Not using it at all seems to work.

bmorton commented 11 years ago

With homebrew, this worked fine for me:

RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p0
jeremy commented 11 years ago
configure: WARNING: unrecognized options: --with-openssl-dir

Confusingly, this is normal. Ruby doesn't recognize the option, but the openssl extension does.

jeremy commented 11 years ago

(Yes, the issue is using CONFIGURE_OPTS rather than RUBY_CONFIGURE_OPTS)

kewinwang commented 11 years ago

get an error :

➜  ~  RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p0
title:8: parse error
Downloading ruby-2.0.0-p0.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
rmoriz commented 11 years ago

@kewin2010 zsh user? try env RUBY_CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl--with-readline-dir=brew --prefix readline" rbenv install 2.0.0-p0 => https://github.com/sstephenson/ruby-build/wiki

davidcelis commented 11 years ago

Strange. @rmoriz I'm also a zsh user and I didn't have to prepend RUBY_CONFIGURE_OPTS with a call to env.

skull-squadron commented 11 years ago

Same error.

For now, I'm giving up on enmasse on brew, rbenv, ruby-build and the whole broken model of local development that is just too different subtly than production for getting sh*t done reliably.

This is another reason http://www.12factor.net/dev-prod-parity trumps trying to force Apples to be Ubuntus.

Labor- and change-intensive garbage of maintaining two dev platforms (and prod too) is more than morally wrong, it's inherently cargo cult stupid.

ProTip: Use configuration management and be able to rebuild your current environment pristine all the time: http://jtimberman.housepub.org/blog/2011/04/03/managing-my-workstations-with-chef/

jeremy commented 11 years ago

@steakknife What, you don't deploy to MacOS? :trollface:

more than morally wrong, it's inherently cargo cult stupid.

As long as you're being a jerk on the Internet, you could probably get away with Godwinning a holocaust reference.

lindemannrichard commented 11 years ago

Had the same problem, nothing helped. I had several outcomes: 1) OPENSSL works, READLINE does not. 2) OPENSSL does not work, READLINE does. 3) Does not compile at all.

Finally this solution worked on my Mac. original post: https://github.com/sstephenson/ruby-build/issues/315#issuecomment-18927131 gist: https://gist.github.com/mscottford/5707976

env CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p195