Chef-solo + rbenv + ree-1.8.7 + tcmalloc error headache

Wojciech Ziniewicz
Stories imported from wordpress
1 min readAug 1, 2013

Have you ever hit the “tcmalloc” problem while installing rbenv’s ree-1.8.7?

Did you try to solve the problem by adding

[code language=”ruby”]

“CONFIGURE_OPTS” => “ — no-tcmalloc”?

[/code]

Sure — but it does not work as expected. Fnichol’s rbenv recipe (rbenv + ruby_build) with my rbenv json throws following error:

[code language=”ruby”]

Chef::Exceptions::ValidationFailed
— — — — — — — — — — — — — — — — —
Option definition must be a kind of String! You passed {“name”=>”ree-1.8.7–2012.02", “environment”=>{“CONFIGURE_OPTS”=>” — no-tcmalloc — no-dev-docs”}}.

Cookbook Trace:
— — — — — — — -
/home/smoker/chef/current/cookbooks/rbenv/recipes/user.rb:29:in `block (3 levels) in from_file’
/home/smoker/chef/current/cookbooks/rbenv/recipes/user.rb:28:in `block (2 levels) in from_file’
/home/smoker/chef/current/cookbooks/rbenv/recipes/user.rb:26:in `each’
/home/smoker/chef/current/cookbooks/rbenv/recipes/user.rb:26:in `block in from_file’
/home/smoker/chef/current/cookbooks/rbenv/recipes/user.rb:22:in `each’
/home/smoker/chef/current/cookbooks/rbenv/recipes/user.rb:22:in `from_file’

[/code]

My json is :

[code language=”json”]
“rbenv”: {
“user_installs”: [
{
“user”: “myuser”,
“rubies”: [
{
“name”: “ree-1.8.7–2012.02”,
“environment”: {
“CONFIGURE_OPTS”: “ — no-tcmalloc — no-dev-docs”
}
}
],
“global”: “ree-1.8.7–2012.02”,
“gems”: {
“ree-1.8.7–2012.02”: [
{
“name”: “bundler”
}
]
}
},
]
}
[/code]

So there’s a simple patch that will let you define configure_opts that are used to compile rubies in Hash format. You should patch your cookbooks/rbenv/recipes/user.rb

[code language=”ruby”]

rubies.each do |rubie|
if rubie.is_a?(Hash)
- rbenv_ruby “#{rubie} (#{rbenv_user[‘user’]})” do
- definition rubie
+ rbenv_ruby “#{rubie.name} (#{rbenv_user[‘user’]})” do
+ definition rubie.name
user rbenv_user[‘user’]
root_path rbenv_user[‘root_path’] if rbenv_user[‘root_path’]
environment rubie[‘environment’] if rubie[‘environment’]
[/code]

--

--