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

mysql2 0.4.6 error: use of undeclared identifier 'MYSQL_SECURE_AUTH' #1222

Closed
asiansteev opened this issue Oct 2, 2018 · 4 comments
Closed

Comments

@asiansteev
Copy link

asiansteev commented Oct 2, 2018

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

compiling client.c
client.c:869: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.6' --source 'https://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 gemspec, it works. I will make a pull request with this change. Thanks!

devise_token_auth 0.2.0
ruby 2.3.7p456
osx 10.13.6

Full error:

$ bundle install
Warning: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/................
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.4
Using activesupport 5.1.4
Using builder 3.2.3
Using erubi 1.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.1
Using rails-dom-testing 2.0.3
Using crass 1.0.3
Using loofah 2.1.1
Using rails-html-sanitizer 1.0.3
Using actionview 5.1.4
Using rack 2.0.3
Using rack-test 0.8.2
Using actionpack 5.1.4
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.4
Using globalid 0.4.1
Using activejob 5.1.4
Using mini_mime 1.0.1
Using mail 2.7.0
Using actionmailer 5.1.4
Using activemodel 5.1.4
Using arel 8.0.0
Using activerecord 5.1.4
Using public_suffix 2.0.5
Using addressable 2.5.1
Using ansi 1.5.0
Using bundler 1.16.2
Using thor 0.20.0
Using appraisal 2.2.0
Using ast 2.4.0
Using encryptor 3.0.0
Using attr_encrypted 3.0.3
Using bcrypt 3.1.12
Using byebug 10.0.2
Using docile 1.1.5
Using json 2.1.0
Using simplecov-html 0.10.0
Using simplecov 0.13.0
Using codeclimate-test-reporter 1.0.8
Using coderay 1.1.1
Using orm_adapter 0.5.0
Using method_source 0.8.2
Using railties 5.1.4
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.5.0
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.1.4
Using devise_token_auth 1.0.0.rc1 from source at `.`
Using factory_bot 4.10.0
Using factory_bot_rails 4.10.0
Using faker 1.9.1
Using multipart-post 2.0.0
Using faraday 0.11.0
Using faraday-http-cache 2.0.0
Using ffi 1.9.18
Using figaro 1.1.1 from https://github.com/laserlemon/figaro (at master@8dd678f)


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: 
Using formatador 0.2.5
Using fuzz_ball 0.9.1
Using multi_json 1.12.1
Using sawyer 0.8.1
Using octokit 4.7.0
Using rainbow 3.0.0
Using retriable 2.1.0
Using github_changelog_generator 1.14.3
Using rb-fsevent 0.9.8
Using rb-inotify 0.9.8
Using ruby_dep 1.5.0
Using listen 3.1.5
Using lumberjack 1.0.12
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.1
Using slop 3.6.0
Using pry 0.10.4
Using guard 2.14.1
Using guard-compat 1.2.1
Using guard-minitest 2.4.6
Using hashie 3.5.5
Using jwt 1.5.6
Using metaclass 0.0.4
Using minitest-focus 1.1.2
Using minitest-rails 3.0.0
Using ruby-progressbar 1.9.0
Using minitest-reporters 1.1.18
Using mocha 1.5.0
Using multi_xml 0.6.0
Fetching mysql2 0.4.6
Installing mysql2 0.4.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/private/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-57834-9031iamysql2-0.4.6/gems/mysql2-0.4.6/ext/mysql2
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20181002-57834-18ndmht.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-57834-9031iamysql2-0.4.6/gems/mysql2-0.4.6/ext/mysql2
make "DESTDIR=" clean

current directory:
/private/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-57834-9031iamysql2-0.4.6/gems/mysql2-0.4.6/ext/mysql2
make "DESTDIR="
compiling client.c
client.c:869: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:1291: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,
  ^
2 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-57834-9031iamysql2-0.4.6/gems/mysql2-0.4.6
for inspection.
Results logged to
/var/folders/p7/_gx_dt3x5sn5tg4pksl42ws40000gn/T/bundler20181002-57834-9031iamysql2-0.4.6/extensions/universal-darwin-17/2.3.0/mysql2-0.4.6/gem_make.out

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

In Gemfile:
  mysql2
asiansteev added a commit to asiansteev/devise_token_auth that referenced this issue Oct 2, 2018
… undeclared identifier 'MYSQL_SECURE_AUTH'
@dks17
Copy link
Contributor

dks17 commented Oct 2, 2018

@asiansteev Hello.
I am not sure it is the gem issue. The gem does not restrict version of mysql2 gem.

# Declare your gem's dependencies in devise_token_auth.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

s.add_development_dependency 'mysql2'

I think the issue occurs on your machine.

Try to remove all versions of mysql2 gem and install suitable version again.

@asiansteev
Copy link
Author

the version is locked at 0.4.6 in the Gemfile.lock. In order to push it forward, the version needs to be bumped in the gemspec
https://github.com/lynndylanhurley/devise_token_auth/blob/master/Gemfile.lock#L180

asiansteev added a commit to asiansteev/devise_token_auth that referenced this issue Oct 2, 2018
… undeclared identifier 'MYSQL_SECURE_AUTH'
@dks17
Copy link
Contributor

dks17 commented Oct 3, 2018

@asiansteev Did you run bundle update?

Try to delete Gemfile.lock when run bundle.

@lucasocon
Copy link

I fixed this issue removing the mysql gem version from the Gemfile.lock

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

Successfully merging a pull request may close this issue.

4 participants