Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Mysql chef gem compilation error #13

Open
jenssegers opened this issue Jun 30, 2014 · 15 comments
Open

Mysql chef gem compilation error #13

jenssegers opened this issue Jun 30, 2014 · 15 comments

Comments

@jenssegers
Copy link

When running mariadb::ruby I get this error:

  * chef_gem[mysql] action install
================================================================================
Error executing action `install` on resource 'chef_gem[mysql]'
================================================================================


Gem::Installer::ExtensionBuildError
-----------------------------------
ERROR: Failed to build gem native extension.

        /opt/chef/embedded/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/opt/chef/embedded/bin/ruby
    --with-mysql-config
    --without-mysql-config
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
    from extconf.rb:45:in `<main>'


Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mysql-2.9.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out



Cookbook Trace:
---------------
/root/chef-solo/cookbooks-2/mariadb/recipes/ruby.rb:34:in `from_file'


Resource Declaration:
---------------------
# In /root/chef-solo/cookbooks-2/mariadb/recipes/ruby.rb

 34: chef_gem 'mysql'



Compiled Resource:
------------------
# Declared in /root/chef-solo/cookbooks-2/mariadb/recipes/ruby.rb:34:in `from_file'

chef_gem("mysql") do
  provider Chef::Provider::Package::Rubygems
  action :install
  retries 0
  retry_delay 2
  guard_interpreter :default
  package_name "mysql"
  version "2.9.1"
  cookbook_name :mariadb
  recipe_name "ruby"
end

Is there a way to fix this? Maybe I'm missing some dependencies?

@joerocklin
Copy link
Owner

I haven't spent much time with the ruby recipe recently. I'll see if I can take a look at it later today and piece together what might be happening.

@jenssegers
Copy link
Author

I have been struggling with this issue for a whole day, still can't get it to work :s

@bpieck
Copy link

bpieck commented Jul 1, 2014

I had an issue for myself and used another way to go around (just copied some lines from the opscode mysql cookbook ^^). Perhaps my mariadb::ruby can help you, too? You could try my fork.
If it helps, I would open a pull request for Joe.

@jenssegers
Copy link
Author

@bpieck I did a similar pull request: #14

But it still did not solve the compilation issue.

@jenssegers
Copy link
Author

The mysql2 gem has no problems by the way.

@bpieck
Copy link

bpieck commented Jul 1, 2014

Wouldn't it work for you, to fork the database cookbook and just move to mysql2? It doesn't make sense to use both, I think.

@jenssegers
Copy link
Author

I'm not really a Ruby developer, so I don't know what the main differences are between those 2 :)

@bpieck
Copy link

bpieck commented Jul 1, 2014

short anwer: it's faster, a bit longer answer:
http://stackoverflow.com/questions/5411551/what-the-difference-between-mysql-and-mysql2-gem

@jenssegers
Copy link
Author

It's interface/methods are not really 100% compatible with the mysql gem. I had to change some stuff but it seems to be working now!

@neurogenesis
Copy link

unless the mysql gem is required for the installation / management of mysql / mariadb, then it shouldn't be included. if it is required for that reason, then mysql2 should be used in place of the older mysql gem.

@jenssegers
Copy link
Author

The mysql2 gem is only usable with changes to the database cookbook. So, it would be better if mysql would work :)

@joerocklin
Copy link
Owner

I'm not really sure how to proceed with this one. The opscode database cookbook has moved to using a stand-alone cookbook for the express purpose of installing the mysql gem: https://github.com/opscode-cookbooks/mysql-chef_gem. This would seem to remove the need for the mariadb::ruby recipe. Would there be objections to removing the recipe?

@bpieck
Copy link

bpieck commented Jul 1, 2014

Yes, objections. This mysql-chef_gem won't work, since it includes mysql::client - what does not work with mariadb installation of your cookbook.
Look into Jenssegers pull request or into my fork. We have both adapted these changes into your cookbook (only I did not add the mysql2 chef_gem since database cookbook uses the mysql chef_gem and mysql2 chef_gem never would come into action, unless you use the database-cookbook change to mysql2 jens has made himself).

@bpieck
Copy link

bpieck commented Jul 1, 2014

But I think you don't have to do anything inside this issue. Jens worked around his issue, that must have to do something with his environment. I cannot imagine why he can install mysql2 gem but not mysql gem (both need mariadb headers - so he must have been able to install them, although I thought his error messages imply they would be not existent). I think the discussion about the change to mysql-chef_gem belongs into jens pull request.

@joerocklin
Copy link
Owner

@bpieck Objection heard! I'll see if I can get some time to review the PR and get it merged in.

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

No branches or pull requests

4 participants