2.0.0-rc2 build failed #290

Closed
fschwahn opened this Issue Feb 13, 2013 · 37 comments

Comments

Projects
None yet
9 participants

Hi,
I saw the other issue regarding 2.0.0-rc2, and this could be also be an unsupported compiler issue. The build fails at another point:

[1.9.3-p327]  ~  rbenv install 2.0.0-rc2
Downloading openssl-1.0.1e.tar.gz...
-> https://www.openssl.org/source/openssl-1.0.1e.tar.gz
Installing openssl-1.0.1e...
Installed openssl-1.0.1e to /Users/fabian/.rbenv/versions/2.0.0-rc2

Downloading ruby-2.0.0-rc2.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-rc2.tar.gz
Installing ruby-2.0.0-rc2...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/hY/hYECEDfKG5WOHDSntE0sE++++TI/-Tmp-/ruby-build.20130212195909.32592
Results logged to /var/folders/hY/hYECEDfKG5WOHDSntE0sE++++TI/-Tmp-/ruby-build.20130212195909.32592.log

Last 10 log lines:
/Users/fabian/.rbenv/versions/2.0.0-rc2/openssl/include/openssl/hmac.h:102: error: previous declaration of ‘HMAC_CTX_copy’ was here
openssl_missing.c:122: error: conflicting types for ‘EVP_CIPHER_CTX_copy’
/Users/fabian/.rbenv/versions/2.0.0-rc2/openssl/include/openssl/evp.h:502: error: previous declaration of ‘EVP_CIPHER_CTX_copy’ was here
make[2]: *** [openssl_missing.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default nkf libraries
linking shared-object nkf.bundle
ld: warning: directory '/Users/fabian/.rbenv/versions/2.0.0-rc2/lib' following -L not found
make: *** [build-ext] Error 2

I'm on Snow Leopard, with Xcode 3.2.6. My gcc -v output:

Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

I'm using the latest versions of rbenv and ruby-build (I updated from Github yesterday evening). The complete log file is here: https://gist.github.com/fschwahn/4943050#file-ruby-build-20130212195909-32592-log

One more point which made me curious is that the ruby configure script emits this:

configure: WARNING: unrecognized options: --with-openssl-dir

Thanks!

Check if in your environment the variable $CONFIGURE_OPTS is defined, it could be the cause of your problem. If that is not the case then maybe the functions has_broken_mac_openssl() and build_package_mac_openssl() in https://github.com/sstephenson/ruby-build/blob/master/bin/ruby-build#L531 need a review. Please give the output of:

$ echo $CONFIGURE_OPTS

$ openssl version

$ opennsl version 2

$ which openssl

Here is the output:

[1.9.3-p327]  ~  echo $CONFIGURE_OPTS 

[1.9.3-p327]  ~  openssl version
OpenSSL 0.9.8r 8 Feb 2011
[1.9.3-p327]  ~  openssl version 2
usage:version -[avbofpd]
[1.9.3-p327]  ~  which openssl
/usr/bin/openssl

As you can see in the complete logfile, the compilation of openssl finishes successfully. The logfile seems to indicate that it is picked up by the ruby compilation process, even though ruby configure says it doesn't recognize --with-openssl-dir.

Ok, has_broken_mac_openssl() works as expected. A more useful log in this case would be:

$ rbenv --debug install 2.0.0-rc2 2>&1 | tee install.log

After executing that, paste the content of install.log in gist ;)

You can find the install.log here: https://gist.github.com/fschwahn/4943050#file-install-log

Thanks for your help!

Mmmmh, well... ruby-build lacks the support for setting set -x if RBENV_DEBUG=1 from rbenv. So basically we can not know whats happening inside ruby-build that makes configure generate that warning.

@sstephenson, what do you thing about the lack of set -x in ruby-build?

@fschwahn, i am out of ideas... time to sleep :)

Well thanks for your help so far, and have a good night!
I just copied the debug part from rbenv over to ruby-build. There could be a RUBY_BUILD_DEBUG-flag which is passed by rbenv-install if RBENV_DEBUG is set. But I'm not even sure if the debug output of ruby-build will be of any help here.

The updated install.log can be found the gist I posted above, but I have seen nothing wrong with it.

I also installed it with the latest openssl from homebrew, and the installation succeeds in that case:

RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv install 2.0.0-rc2

So there seems to be a problem with the packaged openssl installation in some cases.

I am getting the same install errors on 1.9.3-p374 and p385. If it helps, I'm setting up a new machine for the first time.

Output:

☰  rbenv install 1.9.3-p374
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/kevinsuttle/.rbenv/versions/1.9.3-p374

Downloading ruby-1.9.3-p374.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/90b6c327abcdf30a954c2d6ae44da2a9
Installing ruby-1.9.3-p374...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130221162747.10811
Results logged to /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130221162747.10811.log

Last 10 log lines:
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    return t->num_entries;
    ~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1
make: *** Waiting for unfinished jobs....
☰  rbenv install 1.9.3-p374
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/kevinsuttle/.rbenv/versions/1.9.3-p374

Downloading ruby-1.9.3-p374.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/90b6c327abcdf30a954c2d6ae44da2a9
Installing ruby-1.9.3-p374...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130221162747.10811
Results logged to /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130221162747.10811.log

Last 10 log lines:
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    return t->num_entries;
    ~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1
make: *** Waiting for unfinished jobs....

In my bootstrap scripts, I avoided the following line:
brew install autoconf automake apple-gcc42

Does that have anything to do with it you think? Or is it openssl?

Nope. Tried it. Rehashed. Nothing. Installed openssl too from Homebrew. This is the first problem I've had with RBenv/Ruby-Build of this kind.

Should mention: OSX Mountain Lion 10.8.2, XCode 4.6.

☰  gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

@kevinSuttle I believe your issue is a different one, see for example #287 for a solution.
The problem in my case seems to be the bundled openssl version.

@fschwahn Running export CC=gcc before installing a Ruby worked. Thanks.

@sstephenson Could you post a quick something about exactly what needs to be installed prior as far as XCode/Command Line Tools/Homebrew? There's varying info spread around Github and SO. Thanks.

nurse commented Feb 24, 2013

There are 2 issues.

What is cc?

On latest Xcode 4.x environment:

  • gcc-4.2 doesn't exist unless you install apple-gcc42
  • clang exists. It works well except below build failure.
  • cc is clang. It works well except below build failure.
  • gcc is llvm-gcc. It is buggy

On bit old Xcode 4.x environment:

  • gcc-4.2 doesn't exist unless you install apple-gcc42
  • clang exists. It works well.
  • cc is llvm-gcc. It is buggy
  • gcc is llvm-gcc. It is buggy

More old Xcode 4.x environment:

  • gcc-4.2 exists. It works well.
  • clang exists but too old. It is buggy.
  • cc is llvm-gcc. It is buggy
  • gcc is llvm-gcc. It is buggy

On Xcode 3.2.6,

  • gcc-4.2 exists. It works well.
  • clang exists but too old. It is buggy.
  • cc is gcc-4.2. It works well.
  • gcc is gcc-4.2. It works well.

(@shinh pointed that Xcode 3.2.6'cc and gcc are gcc-4.2, thanks)

So if you support Xcode 3.x and 4.2,

  • If it is OS X
    • use gcc-4.2 if it exists
    • use clang if it exists
    • raise error
  • else Don't set CC

clang's warning improvement and side effect

Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
doesn't hit sstephenson#296 (comment) but Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) hit it. This is because latest clang shows more warnings.

You can avoid this by setting -Wno-error=shorten-64-to-32 to CFLAGS. (Ruby itself also will apply patch https://bugs.ruby-lang.org/issues/7946#change-36951)

I feel like you're making a point, but, being a newb, I don't know what it is. :)

Here's the output for 2.0.0-p-0

Downloading openssl-1.0.1e.tar.gz...
-> https://www.openssl.org/source/openssl-1.0.1e.tar.gz
Installing openssl-1.0.1e...
Installed openssl-1.0.1e to /Users/kevinsuttle/.rbenv/versions/2.0.0-p0

Downloading ruby-2.0.0-p0.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
Installing ruby-2.0.0-p0...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130224134426.39872
Results logged to /var/folders/gl/zrvk3vz908g96m9fds51ytz40000gn/T/ruby-build.20130224134426.39872.log

Last 10 log lines:
installing default gems:      /Users/kevinsuttle/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
                              bigdecimal 1.2.0
                              io-console 0.4.2
                              json 1.7.7
                              minitest 4.3.2
                              psych 2.0.0
                              rake 0.9.6
                              rdoc 4.0.0
                              test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

It's odd. It "installs" the OpenSSL lib, even though I installed it with Homebrew already, then complains that it is missing, when technically it should have been installed at least twice by now.

@kevinSuttle I got the exact same output on my Mac. I've had no luck. This was my 3rd install attempt. Did anybody find a workaround?

@codeblooded @kevinSuttle for the error with implicit conversion loses integer precision: 'st_index_t', this is due to an issue compiling with clang 2.x on OSX, please have following flag set up and you'll be good to go:

export CFLAGS=-Wno-error=shorten-64-to-32

FYI, I documented how to install ruby-1.9.3-p392 here: https://gist.github.com/joneslee85/5025729

I solved my issue by downloading openssl via homebrew and then linking to it as such:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl" rbenv install 2.0.0-p0

Update: It decided that it didn't like the nested brew --prefix openssl, so I ran the command myself, copied the output and pasted it in.

@joneslee85 @codeblooded Are these commands that you need to run before each install?

@joneslee85 Would it be better to run a check in rbenv-install? I know it's not everyday you install a new Ruby, but it would be convenient not to have to do that.

uasi referenced this issue in plamoni/SiriProxy Feb 25, 2013

Closed

Ruby Installation Error #436

@kevinSuttle I've never had problems with installing ruby before. These commands are new to me, and I have installed multiple versions of ruby with ruby-build. For some reason my setup did not want to compile the OpenSSL portion; therefore, I needed to install via Homebrew and pointed to the homebrew installed directory. I agree that ruby-build should have some type of checking system (to avoid these issues before installation), and I would definitely be willing to contribute to such a project.

@codeblooded I've never had any issues either until now. This is a brand new OS install, and I thought I had it set up the same way. I never had to do any of these acrobatics on my previous machine.

Wonder if Homebrew is fighting with my system. See: https://gist.github.com/joneslee85/5025729/#comment-781485

@kevinSuttle I didn't install Readline with my installation and it worked. Also, somebody in another issue said to use RUBY_CONFIGURE_OPTS. Here's what I did to install:

$ brew install openssl
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p0

I just ran into a "parse issue" with the nested brew --prefix openssl, so I ran that command separately copied it to my clipboard and pasted it in. My command looked like this:

$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.0.0-p0

And after all of that, I had a successful install. Talk about acrobatics 😓

@ghost

ghost commented Feb 25, 2013

I get the same output as @kevinSuttle posted above (sstephenson#290 (comment)).

This is on OS X 10.8.2, with Xcode 4.6 installed. No Homebrew.

Collaborator

jeremy commented Feb 25, 2013

This is getting far off track from the original issue.

@fschwahn -

configure: WARNING: unrecognized options: --with-openssl-dir

This is normal. The Ruby config doesn't know that option, but the openssl extension does.

Could you gist the contents of ext/openssl/mkmf.log from your build directory?

d6rkaiz commented Feb 25, 2013

@kevinSuttle would you install autoconf and automake?

if not installed:

brew install autoconf automake

btw openssl and readline:

recommend after the installation

$ brew link openssl
$ brew link readline

Then it becomes a simple install.

$ rbenv install 2.0.0-p0

@d6rkaiz et al: I have all of those.

RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.0.0-p0
FINALLY worked.

Last post. :)

d6rkaiz commented Feb 25, 2013

@kevinSuttle I'm sorry about that.

@d6rkaiz No sweat!

Contributor

sorah commented Feb 25, 2013

I use --with-openssl-dir=$(brew --prefix openssl) --with-readline-dir=$(brew --prefix readline) usually

@jeremy I should have been more specific when I named the issue. Here is the logfile you asked for:

https://gist.github.com/fschwahn/4943050/raw/00e018eb3a74e6784426b9c1bf051d299d274fc8/mkmf.log

@jeremy ok, so it has something to do with the no-shared flag you pass to openssl. If I replace no-shared with shared the build finishes. This flag is also mentioned in #304 . Hope this helps you to fix the issue.

Collaborator

jeremy commented Feb 25, 2013

Thanks @fschwahn!

Collaborator

jeremy commented Feb 25, 2013

Fixed @ fee1e49

jeremy closed this Feb 25, 2013

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