anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
317 stars 82 forks source link

mysql2 0.4.5 error: use of undeclared identifier 'MYSQL_SECURE_AUTH' #174

Closed asiansteev closed 3 years ago

asiansteev commented 5 years ago

When bundle installing, I get the following error when attempting to install the mysql2 gem:

compiling client.c
In file included from client.c:1:
In file included from ./mysql2_ext.h:41:
./result.h:24:3: error: unknown type name 'my_bool'
  my_bool *is_null;
  ^
./result.h:25:3: error: unknown type name 'my_bool'
  my_bool *error;
  ^
client.c:507:3: error: use of undeclared identifier 'my_bool'
  my_bool res = mysql_read_query_result(client);
  ^
client.c:509:19: error: use of undeclared identifier 'res'
  return (void *)(res == 0 ? Qtrue : Qfalse);
                  ^
client.c:828:3: error: use of undeclared identifier 'my_bool'
  my_bool boolval;
  ^
client.c:859:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:860:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:863:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did
you mean 'MYSQL_DEFAULT_AUTH'?

at the end of the error it suggests to:

Make sure that `gem install mysql2 -v '0.4.5' --source 'http://rubygems.org/'`
succeeds before bundling.

When I attempt that I get the same error. I found this solution on stackoverflow, which suggests using at least mysql2 version 0.4.10. When I put 0.4.10 in the Gemfile, it works. I will make a pull request with this change. Thanks!

ruby 2.3.7p456 osx 10.13.6

Full error:

Stevens-MacBook-Pro:mongify steev$ bundle install
Fetching gem metadata from http://rubygems.org/.......
Using rake 11.3.0
Using i18n 0.7.0
Using json 1.8.6
Using minitest 5.9.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.7.1
Using builder 3.2.2
Using activemodel 4.2.7.1
Using arel 6.0.3
Using activerecord 4.2.7.1
Using awesome_print 1.7.0
Using bson 1.12.5
Using bson_ext 1.12.5
Using bundler 1.16.2
Using byebug 9.0.6
Using coderay 1.1.1
Using unicode_utils 1.4.0
Using coolline 0.5.0
Using gherkin 4.0.0
Using cucumber-core 1.5.0
Using cucumber-wire 0.0.1
Using diff-lcs 1.2.5
Using multi_json 1.12.1
Using multi_test 0.1.2
Using cucumber 2.4.0
Using highline 1.7.8
Using hirb 0.7.3
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.4
Using pry-byebug 3.4.0
Using pry-coolline 0.2.5
Using yard 0.9.12
Using pry-doc 0.9.0
Using jazz_fingers 4.0.1
Using metaclass 0.0.4
Using mocha 1.2.1
Using mongo 1.12.5
Using mongify 1.3.2 from source at `.`

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Fetching mysql2 0.4.5
Installing mysql2 0.4.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/private/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-56922-2efgjqmysql2-0.4.5/gems/mysql2-0.4.5/ext/mysql2
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20181002-56922-u0ihqo.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 SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
-----
creating Makefile

current directory:
/private/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-56922-2efgjqmysql2-0.4.5/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean

current directory:
/private/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-56922-2efgjqmysql2-0.4.5/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from client.c:1:
In file included from ./mysql2_ext.h:41:
./result.h:24:3: error: unknown type name 'my_bool'
  my_bool *is_null;
  ^
./result.h:25:3: error: unknown type name 'my_bool'
  my_bool *error;
  ^
client.c:507:3: error: use of undeclared identifier 'my_bool'
  my_bool res = mysql_read_query_result(client);
  ^
client.c:509:19: error: use of undeclared identifier 'res'
  return (void *)(res == 0 ? Qtrue : Qfalse);
                  ^
client.c:828:3: error: use of undeclared identifier 'my_bool'
  my_bool boolval;
  ^
client.c:859:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:860:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:863:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did
you mean 'MYSQL_DEFAULT_AUTH'?
    case MYSQL_SECURE_AUTH:
         ^~~~~~~~~~~~~~~~~
         MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note:
'MYSQL_DEFAULT_AUTH' declared here
  MYSQL_DEFAULT_AUTH,
  ^
client.c:864:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:865:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:896:38: error: use of undeclared identifier 'boolval'
        wrapper->reconnect_enabled = boolval;
                                     ^
client.c:1285:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did
you mean 'MYSQL_DEFAULT_AUTH'?
  return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
                                     ^~~~~~~~~~~~~~~~~
                                     MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note:
'MYSQL_DEFAULT_AUTH' declared here
  MYSQL_DEFAULT_AUTH,
  ^
12 errors generated.
make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-56922-2efgjqmysql2-0.4.5/gems/mysql2-0.4.5
for inspection.
Results logged to
/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-56922-2efgjqmysql2-0.4.5/extensions/universal-darwin-17/2.3.0/mysql2-0.4.5/gem_make.out

An error occurred while installing mysql2 (0.4.5), and Bundler cannot
continue.
Make sure that `gem install mysql2 -v '0.4.5' --source 'http://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  mysql2
anlek commented 5 years ago

Thanks for sharing!