Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation failures against MariaDB Connector/C 3.0.2 #878

Closed
ljfranklin opened this issue Aug 18, 2017 · 11 comments
Closed

Compilation failures against MariaDB Connector/C 3.0.2 #878

ljfranklin opened this issue Aug 18, 2017 · 11 comments
Milestone

Comments

@ljfranklin
Copy link

I'm getting the following error when compiling the gem against the MariaDB C Connector 3.0.2:

creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/var/vcap/data/packages/cloud_controller_ng/c35814b300ca9c86b4f84011949d2eadbf08707e/cloud_controller_ng/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/mysql2-0.4.8/mkmf.log

current directory:
/var/vcap/data/packages/cloud_controller_ng/c35814b300ca9c86b4f84011949d2eadbf08707e/cloud_controller_ng/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.8/ext/mysql2
make "DESTDIR=" clean

current directory:
/var/vcap/data/packages/cloud_controller_ng/c35814b300ca9c86b4f84011949d2eadbf08707e/cloud_controller_ng/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.8/ext/mysql2
make "DESTDIR="
compiling statement.c
In file included from statement.c:1:0:
./mysql2_ext.h:14:23: fatal error: mysql_com.h: No such file or directory
 #include <mysql_com.h>
                       ^
compilation terminated.
make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/var/vcap/data/packages/cloud_controller_ng/c35814b300ca9c86b4f84011949d2eadbf08707e/cloud_controller_ng/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.8
for inspection.
Results logged to
/var/vcap/data/packages/cloud_controller_ng/c35814b300ca9c86b4f84011949d2eadbf08707e/cloud_controller_ng/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/mysql2-0.4.8/gem_make.out

At a glance, looks like the connector project renamed a bunch of files from mysql_*.h to mariadb_*.h. So mysql_com.h is now mariadb_com.h, not sure why they made that change. MariaDB Connector 2.3.0 has the old style mysql_* filenames and works fine with mysql2.

@actsasflinn
Copy link

I'm also seeing this with MariaDB 10.2.8 installed via homebrew on OS X 10.11.6

@actsasflinn
Copy link

My attempt at a patch is at pull request #880

@jaredbeck
Copy link
Contributor

I'm also seeing this with MariaDB 10.2.8 installed via homebrew on OS X 10.11.6

Same for me with OS X 10.12.6, though it sounds like a breaking change in MariaDB 10.2 rather than an OS thing.

Is there a workaround? I'm guessing --with-mysql-dir won't help, because it's finding the correct directory, it's just that the files have been renamed?

@jaredbeck
Copy link
Contributor

jaredbeck commented Aug 23, 2017


Edit: Better workaround below

@jaredbeck
Copy link
Contributor

jaredbeck commented Aug 24, 2017

If you are unable to downgrade mariadb, and you can't wait for #880 to get merged, here's a Gemfile workaround:

# Using a fork of mysql2 because there is no released version that will compile
# against mariadb 10.2.8. There was a breaking change in mariadb 10.2.8 where
# they moved some C header files (https://jira.mariadb.org/browse/MDEV-13370).
# There is a PR to fix this in the mysql2 gem, but it has not been merged yet.
# (https://github.com/brianmario/mysql2/pull/880)
gem "mysql2",
  git: "https://github.com/actsasflinn/mysql2.git",
  ref: "76ee6acb09077503a579f4ba5aae9b4137144957"

@wahidlahlou
Copy link

I worked for me, thanks @jaredbeck! I've been looking all over the place. Cheers.

@ghost
Copy link

ghost commented Sep 8, 2017

The real fix is to not include mysql_com.h (renamed to mariadb_com.h) nor mysql_version.h (renamed to mariadb_version.h) when they don't exist as the #include <mysql.h> will pull in their mariadb counterparts.

@actsasflinn
Copy link

ping

@jaredbeck
Copy link
Contributor

homebrew has released mariadb 10.2.9, which includes compatibility patch https://jira.mariadb.org/browse/MDEV-13773. The only "bad" version is 10.2.8.

Now that I have upgraded to 10.2.9, I am no longer able to reproduce this issue. It is no longer necessary to use actsasflinn's fork in my Gemfile.

However, I believe this issue still needs to be addressed because MDEV-13773 is not intended to be permanent.

@sodabrew sodabrew added this to the 0.4.9 milestone Nov 11, 2017
@actsasflinn
Copy link

I'm still blowing up on mysql_com.h

$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

$ git pull origin master
remote: Counting objects: 39, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 39 (delta 20), reused 29 (delta 19), pack-reused 3
Unpacking objects: 100% (39/39), done.
From https://github.com/brianmario/mysql2
 * branch            master     -> FETCH_HEAD
   9c2d277..151d5f0  master     -> origin/master
Updating 9c2d277..151d5f0
Fast-forward
 .travis_setup.sh           | 10 ++++++++++
 ext/mysql2/client.c        | 11 ++++++++++-
 ext/mysql2/mysql2_ext.h    |  2 --
 spec/mysql2/client_spec.rb |  8 ++++----
 tasks/vendor_mysql.rake    |  2 +-
 5 files changed, 25 insertions(+), 8 deletions(-)

$ gem build mysql2.gemspec 
  Successfully built RubyGem
  Name: mysql2
  Version: 0.4.9
  File: mysql2-0.4.9.gem

$ gem install mysql2-0.4.9.gem 
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2-0.4.9.gem:
	ERROR: Failed to build gem native extension.

    current directory: /Users/flinn/.rvm/gems/ruby-2.4.0/gems/mysql2-0.4.9/ext/mysql2
/Users/flinn/.rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20171111-20763-egqp2s.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
checking for SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... no
checking for MYSQL.net.pvio in mysql.h... yes
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
-----
Setting rpath to /usr/local/Cellar/mariadb/10.2.8/lib
-----
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/flinn/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-15/2.4.0/mysql2-0.4.9/mkmf.log

current directory: /Users/flinn/.rvm/gems/ruby-2.4.0/gems/mysql2-0.4.9/ext/mysql2
make "DESTDIR=" clean

current directory: /Users/flinn/.rvm/gems/ruby-2.4.0/gems/mysql2-0.4.9/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from client.c:1:
./mysql2_ext.h:14:10: fatal error: 'mysql_com.h' file not found
#include <mysql_com.h>
         ^
1 error generated.
make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/flinn/.rvm/gems/ruby-2.4.0/gems/mysql2-0.4.9 for inspection.
Results logged to /Users/flinn/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-15/2.4.0/mysql2-0.4.9/gem_make.out

@sodabrew
Copy link
Collaborator

sodabrew commented Nov 11, 2017 via email

@sodabrew sodabrew modified the milestones: 0.4.9, 0.4.10 Nov 12, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants