gem_package installation issue
geleman opened this issue · comments
I'm attempting to update to the newest mysql cookbook 8.0.2. I was using an older version of mysql2_chef_gem and upgrade to use locally 1.1.0 and getting the same error i did with the older version.
* gem_package[mysql2] action install
================================================================================
Error executing action `install` on resource 'gem_package[mysql2]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
STDOUT: Building native extensions. This could take a while...
STDERR: ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/bin/ruby -r ./siteconf20160906-4638-1ifzp8p.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
extconf failed, exit code 1
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mysql2-0.3.17 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.17/gem_make.out
---- End output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
Ran /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb
21: gem_package 'mysql2' do
22: gem_binary RbConfig::CONFIG['bindir'] + '/gem'
23: version new_resource.gem_version
24: action :install
25: end
26: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:21:in `block in <class:Mysql>'
gem_package("mysql2") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "mysql2"
version "0.3.17"
declared_type :gem_package
cookbook_name "mysql_support"
gem_binary "/opt/chef/embedded/bin/gem"
end
================================================================================
Error executing action `install` on resource 'mysql2_chef_gem[default]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
gem_package[mysql2] (/tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb line 21) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
STDOUT: Building native extensions. This could take a while...
STDERR: ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/bin/ruby -r ./siteconf20160906-4638-1ifzp8p.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
extconf failed, exit code 1
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mysql2-0.3.17 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.17/gem_make.out
---- End output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
Ran /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/mysql_support/recipes/remote_root.rb
3: mysql2_chef_gem 'default' do
4: action :install
5: end
6:
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/mysql_support/recipes/remote_root.rb:3:in `from_file'
mysql2_chef_gem("default") do
action [:install]
updated true
updated_by_last_action true
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :mysql2_chef_gem
cookbook_name "mysql_support"
recipe_name "remote_root"
gem_version "0.3.17"
end
I'm using it with database cookbook to install a user for a remote user. It looks like it is having a compilation issue. The mysql installation is fine
mysql> \s
mysql Ver 14.14 Distrib 5.6.29, for Linux (x86_64) using EditLine wrapper
Connection id: 4
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.29 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /mysql_tmp/mysqld.sock
Uptime: 8 min 50 sec
Threads: 1 Questions: 41 Slow queries: 0 Opens: 87 Flush tables: 1 Open tables: 80 Queries per second avg: 0.077
probably a dulicate of #17
#17 is about yum-mysql-community and version this is a compilation error with mysql2-chef-gem. The might somewhat be related.
For many Linux distros, the compilation process requires files from libmysqlclient-dev or mysql-devel. I added this line to my recipes before the mysql2_chef_gem
resource:
package 'libmysqlclient-dev'
Refer to the installation instructions for the gem at: https://github.com/brianmario/mysql2
@asheperak if this works then it needs to be added to the readme. It works prior to 8.0 without that on centos.
Both issue #21 #22 are fixed by my PR sous-chefs/mysql#492.
@jpmat296 I'm looking at the pr and not seeing where it fixes RHEL/Centos Platform. Right now I'm just add
package 'mysql-devel' to my installs and it solves the issue
I've updated the PR. For Fedora / RHEL / Centos, header file mysql.h is missing without my new PR. HTH