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

installation error in MariaDB 10.2.6 #851

Closed
kim612 opened this issue May 25, 2017 · 29 comments
Closed

installation error in MariaDB 10.2.6 #851

kim612 opened this issue May 25, 2017 · 29 comments
Milestone

Comments

@kim612
Copy link

kim612 commented May 25, 2017

Hi.
macOS Homebrew started to distribute MariaDB 10.2.6 recently.
But when I installed mysql2 for this version, I found some errors.
MariaDB 10.1.X is still ok, so I changed it and it has no problem.

$ gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config
Building native extensions with: '--with-mysql-config=/usr/local/bin/mysql_config'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

current directory: /usr/local/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6/ext/mysql2

/usr/local/opt/ruby/bin/ruby -r ./siteconf20170525-2285-kb0wzp.rb extconf.rb --with-mysql-config=/usr/local/bin/mysql_config
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 SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes

Setting rpath to /usr/local/Cellar/mariadb/10.2.6/lib

creating Makefile

current directory: /usr/local/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6/ext/mysql2
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6/ext/mysql2
make "DESTDIR="
compiling client.c
client.c:138:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
client.c:923:32: error: use of undeclared identifier 'MYSQL_SERVER_VERSION'
header_version = rb_str_new2(MYSQL_LINK_VERSION);
^
client.c:53:30: note: expanded from macro 'MYSQL_LINK_VERSION'
#define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
^
client.c:923:32: error: use of undeclared identifier 'MYSQL_SERVER_VERSION'
client.c:53:30: note: expanded from macro 'MYSQL_LINK_VERSION'
#define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
^
client.c:923:32: error: use of undeclared identifier 'MYSQL_SERVER_VERSION'
client.c:53:30: note: expanded from macro 'MYSQL_LINK_VERSION'
#define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
^
client.c:923:32: error: use of undeclared identifier 'MYSQL_SERVER_VERSION'
client.c:53:30: note: expanded from macro 'MYSQL_LINK_VERSION'
#define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
^
client.c:923:18: error: assigning to 'VALUE' (aka 'unsigned long') from incompatible type 'void'
header_version = rb_str_new2(MYSQL_LINK_VERSION);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 5 errors generated.
make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/mysql2-0.4.6/gem_make.out

Thank you!

@sodabrew
Copy link
Collaborator

I wonder if they've renamed this macro in MariaDB 10.2. I'll take a look, thanks for reporting this!

@otzy007
Copy link

otzy007 commented May 25, 2017

I'm having the same isssue :(

@charlietag
Copy link

charlietag commented May 25, 2017

Same here (CentOS 7.3 , Ruby 2.3.1 , gem 2.6.12)
-------------------------------ERROR MSG------------------------------

root@test ~
#  gem install mysql2 -v '0.4.6'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/mysql2-0.4.6/ext/mysql2
/usr/local/bin/ruby -r ./siteconf20170525-9879-1edbunk.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 /bin/mysql_config
-----
checking for mysql.h... yes
checking for SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib64
-----
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/mysql2-0.4.6/ext/mysql2
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/mysql2-0.4.6/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from ./mysql2_ext.h:39:0,
                 from client.c:1:
client.c: In function ‘rb_set_ssl_mode_option’:
./client.h:57:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
client.c:110:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(self);
   ^
client.c:111:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   int val = NUM2INT( setting );
   ^
In file included from /usr/local/include/ruby-2.3.0/ruby/ruby.h:1992:0,
                 from /usr/local/include/ruby-2.3.0/ruby.h:33,
                 from ./mysql2_ext.h:10,
                 from client.c:1:
client.c: In function ‘rb_mysql_client_info’:
client.c:53:30: error: ‘MYSQL_SERVER_VERSION’ undeclared (first use in this function)
   #define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
                              ^
/usr/local/include/ruby-2.3.0/ruby/intern.h:805:27: note: in definition of macro ‘rb_str_new_cstr’
     (__builtin_constant_p(str)) ?  \
                           ^
client.c:923:32: note: in expansion of macro ‘MYSQL_LINK_VERSION’
   header_version = rb_str_new2(MYSQL_LINK_VERSION);
                                ^
client.c:53:30: note: each undeclared identifier is reported only once for each function it appears in
   #define MYSQL_LINK_VERSION MYSQL_SERVER_VERSION
                              ^
/usr/local/include/ruby-2.3.0/ruby/intern.h:805:27: note: in definition of macro ‘rb_str_new_cstr’
     (__builtin_constant_p(str)) ?  \
                           ^
client.c:923:32: note: in expansion of macro ‘MYSQL_LINK_VERSION’
   header_version = rb_str_new2(MYSQL_LINK_VERSION);
                                ^
client.c: In function ‘rb_set_ssl_mode_option’:
client.c:138:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/mysql2-0.4.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/mysql2-0.4.6/gem_make.out

-------------------------------ERROR MSG------------------------------

@MatthiasWinkelmann
Copy link
Contributor

MatthiasWinkelmann commented May 27, 2017

Yeah–me too, and I'd expect a lot more people will run into this once the long weekend in the US ends.

FWIW I tried and added #include <mysql_version.h> to /ext/client.c. This actually fixed the compilation issue, but any attempt to connect to a database from ruby results in a segfault (log attached)
ruby.crash.txt

. Sorry for not being of more help, my C is weak. I've also now tried it with MariaDB 10.2.5, so the problem is not in the switch from 10.1.x->10.2.x, but in the point release 10.2.5->10.2.6

Here's how to install the previous (working) mariaDB 10.2.5 or 10.2.22 (EDIT: see below for an easier method by @dguzek):

  • Replace the formula in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mariadb.rb with the previous version.

  • Reinstall MariaDB:
    brew uninstall mariadb
    brew install mariadb
    (use --devel to install 10.2.5 which also works)

  • (Re)install mysql2

@quietly-turning
Copy link

quietly-turning commented May 27, 2017

For the time being, it seems this problem can also be resolved on macOS by unlinking mariadb and installing mariadb-connector-c. From there, you should be able to reinstall mysql2.

brew unlink mariadb
brew install mariadb-connector-c
gem uninstall mysql2
gem install mysql2

Unfortunately, I don't understand the problem well enough to be of any more help than that.

@mkastner
Copy link

mkastner commented May 27, 2017

Yep, same here.

@dguzek you just saved my sunday. Thanks! I've just spent three hours trying solve this.

@otherguy
Copy link

@dguzek You saved my tuesday as well ❤️

@sodabrew sodabrew added this to the 0.4.7 milestone Jun 1, 2017
@sodabrew
Copy link
Collaborator

sodabrew commented Jun 1, 2017

I haven't had a moment to get MariaDB 10.2 installed to see what's different/missing from its headers, but I will gate the next 0.4.7 release on sorting this out.

PRs welcome if anybody wants to take a stab at this before I have time to get to it!

@foalford
Copy link

foalford commented Jun 4, 2017

I bumped into this too. Did below and gem install mysql2 succeeded.

+++ /usr/include/mysql/mysql.h  
@@ -58,6 +58,7 @@
 #endif
 #include "mariadb_com.h"
 #include "mariadb_version.h"
+#include "mysql_version.h"
 #include "ma_list.h"
 #include "mariadb_ctype.h" 

The missing MYSQL_SERVER_VERSION is defined in mysql_verion.h file which wasn't included in common header file. However this macro is only needed when LIBMYSQL_VERSION is not present, which is brought by mariadb-connector-c (on OS X).

@Zelnox
Copy link

Zelnox commented Jun 5, 2017

I tried @foalford’s suggestion by editing usr/local/include/mysql/mysql.h and relink.
The gem installs successfully (still using 0.3.20), but when running tests in my Rails project, I ran into
NameError: uninitialized constant Mysql2::Client::LONG_PASSWORD
I tried with mysql2 0.4.6, but running tests also raises the same name error.

@guaguasi
Copy link

guaguasi commented Jun 6, 2017

diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c
index 2f20512..17a2c80 100644
--- a/ext/mysql2/client.c
+++ b/ext/mysql2/client.c
@@ -1419,6 +1419,11 @@ void init_mysql2_client() {
 #ifdef CLIENT_LONG_PASSWORD
   rb_const_set(cMysql2Client, rb_intern("LONG_PASSWORD"),
       LONG2NUM(CLIENT_LONG_PASSWORD));
+#elif defined(MARIADB_BASE_VERSION)
+  if (strcmp(MARIADB_BASE_VERSION, "mariadb-10.2") == 0) {
+    rb_const_set(cMysql2Client, rb_intern("LONG_PASSWORD"),
+        LONG2NUM(0));
+  }
 #endif

 #ifdef CLIENT_FOUND_ROWS
diff --git a/ext/mysql2/mysql2_ext.h b/ext/mysql2/mysql2_ext.h
index f53f4b4..cb4a1de 100644
--- a/ext/mysql2/mysql2_ext.h
+++ b/ext/mysql2/mysql2_ext.h
@@ -12,11 +12,13 @@ void Init_mysql2(void);
 #ifdef HAVE_MYSQL_H
 #include <mysql.h>
 #include <mysql_com.h>
+#include <mysql_version.h>
 #include <errmsg.h>
 #include <mysqld_error.h>
 #else
 #include <mysql/mysql.h>
 #include <mysql/mysql_com.h>
+#include <mysql/mysql_version.h>
 #include <mysql/errmsg.h>
 #include <mysql/mysqld_error.h>
 #endif

I was able to get it to compile with the above patch and it appears to run fine (barely tested it), but when I attempt to run the tests, I get a segfault. I don't think that's normal, but I don't know.

The issue appears to be due to 10.2 using mariadb_com.h which defines _mysql_com_h thereby causing the mysql_com.h included in mysql2_ext.h, which defines CLIENT_LONG_PASSWORD, to be skipped over. According to mysql_com.h, CLIENT_LONG_PASSWORD is "obsoleted".

I also can't compile against HEAD, but I'll look into that tomorrow. I get the following errors when I try:

[lawrence@dev-01 mysql2]$ rake
RuboCop is not available
cd tmp/x86_64-linux/mysql2/2.4.1
/usr/bin/gmake
compiling ../../../../ext/mysql2/client.c
../../../../ext/mysql2/client.c: In function ‘decr_mysql2_client’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:291:9: note: in expansion of macro ‘CONNECTED’
     if (CONNECTED(wrapper) && !wrapper->automatic_close) {
         ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_closed’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:484:10: note: in expansion of macro ‘CONNECTED’
   return CONNECTED(wrapper) ? Qfalse : Qtrue;
          ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_async_result’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:565:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘disconnect_and_raise’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:610:7: note: in expansion of macro ‘CONNECTED’
   if (CONNECTED(wrapper)) {
       ^
../../../../ext/mysql2/client.c: In function ‘disconnect_and_mark_inactive’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:671:9: note: in expansion of macro ‘CONNECTED’
     if (CONNECTED(wrapper)) {
         ^
../../../../ext/mysql2/client.c: In function ‘rb_query’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:752:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_real_escape’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:808:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘_mysql_client_options’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:43:7: note: in expansion of macro ‘CONNECTED’
   if (CONNECTED(wrapper)) { \
       ^
../../../../ext/mysql2/client.c:852:3: note: in expansion of macro ‘REQUIRE_NOT_CONNECTED’
   REQUIRE_NOT_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_server_info’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:969:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_socket’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:996:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_last_id’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:1013:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_affected_rows’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:1027:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_thread_id’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:1044:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_select_db’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:1069:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_ping’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:1097:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper)) {
        ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_prepare_statement’:
../../../../ext/mysql2/client.c:33:49: error: ‘NET’ has no member named ‘vio’
 #define CONNECTED(wrapper) (wrapper->client->net.vio != NULL && wrapper->client->net.fd != -1)
                                                 ^
../../../../ext/mysql2/client.c:37:8: note: in expansion of macro ‘CONNECTED’
   if (!CONNECTED(wrapper) && !wrapper->reconnect_enabled) { \
        ^
../../../../ext/mysql2/client.c:1347:3: note: in expansion of macro ‘REQUIRE_CONNECTED’
   REQUIRE_CONNECTED(wrapper);
   ^
../../../../ext/mysql2/client.c: In function ‘init_mysql2_client’:
../../../../ext/mysql2/client.c:1446:28: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if (MARIADB_BASE_VERSION == "mariadb-10.2") {
                            ^
../../../../ext/mysql2/client.c: In function ‘rb_set_ssl_mode_option’:
../../../../ext/mysql2/client.c:140:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_ping’:
../../../../ext/mysql2/client.c:1102:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
../../../../ext/mysql2/client.c: In function ‘rb_mysql_client_closed’:
../../../../ext/mysql2/client.c:485:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
../../../../ext/mysql2/client.c: At top level:
cc1: warning: unrecognized command line option "-Wno-used-but-marked-unused" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-static-in-inline" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-reserved-id-macro" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-missing-variable-declarations" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-documentation-unknown-command" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-disabled-macro-expansion" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-covered-switch-default" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-conditional-uninitialized" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
gmake: *** [client.o] Error 1
rake aborted!
Command failed with status (2): [/usr/bin/gmake...]
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-compiler-1.0.4/lib/rake/extensiontask.rb:166:in `block (2 levels) in define_compile_tasks'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-compiler-1.0.4/lib/rake/extensiontask.rb:165:in `block in define_compile_tasks'
/usr/local/rvm/gems/ruby-2.4.1@global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => default => spec => compile => compile:x86_64-linux => compile:mysql2:x86_64-linux => copy:mysql2:x86_64-linux:2.4.1 => tmp/x86_64-linux/mysql2/2.4.1/mysql2.so
(See full trace by running task with --trace)

@foalford
Copy link

foalford commented Jun 6, 2017

@Zelnox This is an known issue with mysql2 gem. I end up using 10.1 client and gem 0.3.18. Checkout #603

@dgsan
Copy link

dgsan commented Jun 8, 2017

Just ran into this using MariaDB from their Ubuntu repos (https://downloads.mariadb.org/mariadb/repositories/).

@thiensubs
Copy link

@dguzek Thanks you! It work.

@N3X15
Copy link

N3X15 commented Jun 16, 2017

Any progress on this? Reinstalling the package doesn't help, and the patches just lead to segfaults.

@admintpj
Copy link

if it helps, I was able to get the gem to install in Ubuntu by doing what @foalford did, and then removing CLIENT_LONG_PASSWORD from line 12 the client.rb file. As @guaguasi pointed out, it's obsolete, so it's probably not needed anymore.

I don't know if this the most elegant solution or not, so I welcome any feedback to this approach!

@sodabrew
Copy link
Collaborator

Resolved by #857

@sodabrew
Copy link
Collaborator

The CLIENT_LONG_PASSWORD issue will need to be addressed separately.

@jbwl
Copy link

jbwl commented Jul 12, 2017

Would it be possible to also fix this for 0.3.x branch?

@sodabrew
Copy link
Collaborator

sodabrew commented Jul 12, 2017

The mysql2 gem 0.4.x series is drop-in compatible with 0.3.x.

@jbwl
Copy link

jbwl commented Jul 12, 2017

Sorry maybe I asked the wrong question - I want to use the mysql2 gem with Rails 3.2.22.5, which does not work with the mysql2 gem starting from 0.4.x

@fuzzygroup
Copy link

Using Rails 5.1.3, on OSX with MariaDB, the only fix needed was to update from

gem 'mysql2', '~> 0.3.18'

to

gem 'mysql2', '~> 0.4'

And everything worked perfectly. Thank you @sodabrew !

@dsandstrom
Copy link

There is a regression in v0.4.6 for 10.2.9-MariaDB Homebrew, I receive the same errors. However, v0.4.9 installs.

@BrendonW
Copy link

I have a fix for this because we ran into this for some projects that are still running ancient Rails versions. If people are interested I can put together a pull-request to fix this for 0.3.x

@xtrasimplicity
Copy link

@BrendonW It would be great if you could submit a PR, if you haven't already?

@seifertd
Copy link

@BrendonW I also would appreciate a PR for 0.3.x

@justin-
Copy link

justin- commented Sep 4, 2018

@BrendonW I would appreciate this as well

@jujudellago
Copy link

@BrendonW me too, would help a lot

@AlexeyDemidov
Copy link

I have created PR #1014 to fix this build issue on 0.3 branch.

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