Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Failed to install ruby 2.0.0 #149

Closed
ghost opened this issue Dec 2, 2014 · 6 comments · Fixed by #195
Closed

Failed to install ruby 2.0.0 #149

ghost opened this issue Dec 2, 2014 · 6 comments · Fixed by #195
Labels

Comments

@ghost
Copy link

ghost commented Dec 2, 2014

Steps to reproduce:

  1. Bootstrap a clean VM: vagrant up mysql
  2. Prepare chef: knife solo prepare vagrant@127.0.0.1 -p 2222
  3. Update nodes/127.0.0.1.json with the following:
{
  "run_list": [
    "role[rails]"
  ],  
  "automatic": {
    "ipaddress": "127.0.0.1"
  },  
  "authorization": {
    "sudo": {
      "passwordless": true,
      "users": ["vagrant"]
    }   
  },  
  "active_applications": {
    "intercity_sample_app": {
      "ruby_version": "2.0.0-p353",
      "packages": ["nodejs"],
      "rails_env": "production",
      "database_info": {
        "host": "localhost",
        "username": "a",
        "password": "b",
        "database": "db",
        "adapter": "mysql2"
      },  
      "env_vars": {
        "SECRET_KEY_BASE": "..."
      }   
    }   
  }
}
  1. Execute: knife solo cook vagrant@127.0.0.1 -p 2222
  2. Expect the following output:
    Error executing action `install` on resource 'rbenv_ruby[2.0.0-p353]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------

    ---- Begin output of /opt/rbenv/bin/rbenv install 2.0.0-p353 ----
    STDOUT: 
    STDERR: Downloading yaml-0.1.6.tar.gz...
    -> http://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
    Installing yaml-0.1.6...
    Installed yaml-0.1.6 to /opt/rbenv/versions/2.0.0-p353

    Downloading ruby-2.0.0-p353.tar.gz...
    -> http://dqw8nmjcqpjn7.cloudfront.net/465afc77d201b5815bb7ce3660a1f5a131f4429a3fa483c126ce66923e4726cc
    Installing ruby-2.0.0-p353...

    BUILD FAILED (Ubuntu 14.04 using ruby-build 20141128)

    Inspect or clean up the working tree at /tmp/ruby-build.20141202083113.3283
    Results logged to /tmp/ruby-build.20141202083113.3283.log

    Last 10 log lines:
    compiling ossl_pkcs7.c
    compiling ossl_pkcs12.c
    compiling ossl_x509crl.c
    compiling ossl_x509revoked.c
    compiling ossl_rand.c
    installing default openssl libraries
    linking shared-object openssl.so
    make[2]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353/ext/openssl'
    make[1]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353'
    make: *** [build-ext] Error 2
    ---- End output of /opt/rbenv/bin/rbenv install 2.0.0-p353 ----
    Ran /opt/rbenv/bin/rbenv install 2.0.0-p353 returned 1

    Cookbook Trace:
    ---------------
    /home/vagrant/chef-solo/cookbooks-2/rbenv/providers/ruby.rb:35:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /home/vagrant/chef-solo/cookbooks-2/rails/recipes/default.rb

     36:     rbenv_ruby app_info['ruby_version']
     37: 

    Compiled Resource:
    ------------------
    # Declared in /home/vagrant/chef-solo/cookbooks-2/rails/recipes/default.rb:36:in `block in from_file'

    rbenv_ruby("2.0.0-p353") do
      action :install
      retries 0
      retry_delay 2
      guard_interpreter :default
      cookbook_name :rails
      recipe_name "default"
    end


Running handlers:
[2014-12-02T08:37:14+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-12-02T08:37:14+00:00] ERROR: Exception handlers complete
[2014-12-02T08:37:14+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 10 resources updated in 418.599960509 seconds
[2014-12-02T08:37:14+00:00] ERROR: rbenv_ruby[2.0.0-p353] (rails::default line 36) had an error: Mixlib::ShellOut::ShellCommandFailed: 
---- Begin output of /opt/rbenv/bin/rbenv install 2.0.0-p353 ----
STDOUT: 
STDERR: Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /opt/rbenv/versions/2.0.0-p353

Downloading ruby-2.0.0-p353.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/465afc77d201b5815bb7ce3660a1f5a131f4429a3fa483c126ce66923e4726cc
Installing ruby-2.0.0-p353...

BUILD FAILED (Ubuntu 14.04 using ruby-build 20141128)

Inspect or clean up the working tree at /tmp/ruby-build.20141202083113.3283
Results logged to /tmp/ruby-build.20141202083113.3283.log

Last 10 log lines:
compiling ossl_pkcs7.c
compiling ossl_pkcs12.c
compiling ossl_x509crl.c
compiling ossl_x509revoked.c
compiling ossl_rand.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353/ext/openssl'
make[1]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353'
make: *** [build-ext] Error 2
---- End output of /opt/rbenv/bin/rbenv install 2.0.0-p353 ----
Ran /opt/rbenv/bin/rbenv install 2.0.0-p353 returned 1
[2014-12-02T08:37:14+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

Ruby build log (last error):

compiling openssl_missing.c
readline.c: In function 'Init_readline':
readline.c:1886:26: error: 'Function' undeclared (first use in this function)
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                          ^
readline.c:1886:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1886:36: error: expected expression before ')' token
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                                    ^
readline.c: At top level:
readline.c:530:1: warning: 'readline_pre_input_hook' defined but not used [-Wunused-function]
 readline_pre_input_hook(void)
 ^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling ossl_x509ext.c
compiling ossl_ns_spki.c
compiling ossl_pkey_dsa.c
compiling ossl_cipher.c
compiling ossl_pkcs5.c
compiling ossl_ocsp.c
compiling ossl_x509store.c
compiling ossl_pkey.c
compiling ossl_pkey_ec.c
compiling ossl_bio.c
compiling ossl_x509attr.c
compiling ossl_asn1.c
compiling ossl_ssl_session.c
compiling ossl_x509.c
compiling ossl_ssl.c
compiling ossl_x509name.c
compiling ossl_pkcs7.c
compiling ossl_pkcs12.c
compiling ossl_x509crl.c
compiling ossl_x509revoked.c
compiling ossl_rand.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353/ext/openssl'
make[1]: Leaving directory `/tmp/ruby-build.20141202083113.3283/ruby-2.0.0-p353'
make: *** [build-ext] Error 2
@ghost ghost added the bug label Dec 2, 2014
@jvanbaarsen
Copy link
Contributor

@oiuzikov I was not able to reproduce, still having that issue with latest version?

@ghost
Copy link
Author

ghost commented Mar 13, 2015

@jvanbaarsen the issue still exists (ruby-build version 20150303):

BUILD FAILED (Ubuntu 14.04 using ruby-build 20150303)

Inspect or clean up the working tree at /tmp/ruby-build.20150313164520.3138
Results logged to /tmp/ruby-build.20150313164520.3138.log

Last 10 log lines:
compiling ossl_pkcs7.c
compiling ossl_pkcs12.c
compiling ossl_x509crl.c
compiling ossl_x509revoked.c
compiling ossl_rand.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20150313164520.3138/ruby-2.0.0-p353/ext/openssl'
make[1]: Leaving directory `/tmp/ruby-build.20150313164520.3138/ruby-2.0.0-p353'
make: *** [build-ext] Error 2
---- End output of /opt/rbenv/bin/rbenv install 2.0.0-p353 ----
Ran /opt/rbenv/bin/rbenv install 2.0.0-p353 returned 1
[2015-03-13T16:55:07+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

It's something related to ruby-build and readline compatibility: rbenv/ruby-build#587

They suggest to apply patches or something :)

@berkes
Copy link
Collaborator

berkes commented Apr 12, 2015

I can confirm a similar issue with Ruby 2.1.0 on Chef-repo release 2.3.1.

Seems to be covered and fixed in rbenv/ruby-build#526 (comment)

TL;DR use 2.0.0-p481 and 2.1.2

I can confirm that upgrading to 2.1.2 fixes the issue.

The Last lines from my log:

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
make[2]: Leaving directory `/tmp/ruby-build.20150412141408.30731/ruby-2.1.0/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20150412141408.30731/ruby-2.1.0'
make: *** [build-ext] Error 2

Full log on this gist

@jvanbaarsen
Copy link
Contributor

@berkes I'll take a look at this!

@jvanbaarsen
Copy link
Contributor

Problem is confirmed with ruby 2.1.0 on master

@jvanbaarsen
Copy link
Contributor

Problem seems to be in the ruby source itself: rbenv/ruby-build#528.
I'm building a binary now, that way chef-repo users can still install 2.1.0 with a binary that has the fix included.

That does mean however, that compiling ruby 2.1.0 from source will not work with chef-repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants