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

There is a problem when setting up Redmine and using bundle install to install mysql2 0.5.6 #1366

Open
BraveWhite opened this issue May 21, 2024 · 3 comments

Comments

@BraveWhite
Copy link

I have a problem when using bundle to install mysql2 0.5.6
My Ruby is "ruby 3.2.4 (2024-04-23 revision af471c0e01) [x64-mingw-ucrt]"

C:\Users\XXXX\Desktop\redmine-5.1.2>bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching mysql2 0.5.6
Installing mysql2 0.5.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6/ext/mysql2
C:/Ruby32-x64/bin/ruby.exe extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_gc_mark_movable()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... yes
*** 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
--without-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=C:/Ruby32-x64/bin/$(RUBY_BASE_NAME)
--with-openssl-dir
--without-openssl-dir
--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
--with-mysqlclient-dir
--without-mysqlclient-dir
--with-mysqlclient-include
--without-mysqlclient-include=${mysqlclient-dir}/include
--with-mysqlclient-lib
--without-mysqlclient-lib=${mysqlclient-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in block in find_library': undefined method split' for nil:NilClass (NoMethodError)

paths = paths.flat_map {|path| path.split(File::PATH_SEPARATOR)}
                                   ^^^^^^
    from C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `each'
    from C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `flat_map'
    from C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `find_library'
    from extconf.rb:131:in `<main>'

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

C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mysql2-0.5.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6 for inspection.
Results logged to
C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mysql2-0.5.6/gem_make.out

C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:119:in run' C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:28:in build'
C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:187:in build_extension' C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:221:in block in
build_extensions'
C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in each' C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in build_extensions'
C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/installer.rb:846:in build_extensions' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/rubygems_gem_installer.rb:72:in build_extensions'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in install' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/source/rubygems.rb:202:in install'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/installer/gem_installer.rb:54:in
install' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/installer/gem_installer.rb:16:in install_from_spec'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:156:in
do_install' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:147:in block in worker_pool'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/worker.rb:62:in apply_func' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/worker.rb:57:in block in process_queue'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/worker.rb:54:in loop' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/worker.rb:54:in process_queue'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/worker.rb:90:in `block (2 levels) in
create_threads'

An error occurred while installing mysql2 (0.5.6), and Bundler cannot continue.

In Gemfile:
mysql2

If I use
gem install mysql2 --platform=ruby -- --with-mysql-lib="C:\Program Files\MySQL\Connector C++ 8.0\lib64"

C:\Users\XXXX\Desktop\redmine-5.1.2>gem install mysql2 --platform=ruby -- --with-mysql-lib="C:\Program Files\MySQL\Connector C++ 8.0\lib64"
Using msys2 packages: mingw-w64-ucrt-x86_64-libmariadbclient
Building native extensions with: '--with-mysql-lib=C:\Program Files\MySQL\Connector C++ 8.0\lib64'
This could take a while...
Successfully installed mysql2-0.5.6
Parsing documentation for mysql2-0.5.6
Installing ri documentation for mysql2-0.5.6
Done installing documentation for mysql2 after 0 seconds
1 gem installed

It can work

But it will show

C:\Users\XXXX\Desktop\redmine-5.1.2>bundle exec rake generate_secret_token
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'mysql2'. (Bundler::GemRequireError)
Gem Load Error is: Incorrect MySQL client library version! This gem was compiled for 10.8.8 but the client library is 3.3.8.
Backtrace for gem load error is:
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:38:in require' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in require'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:332:in block in require' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:299:in load_dependency'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:332:in require' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6/lib/mysql2.rb:36:in <top (required)>'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/runtime.rb:60:in require' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/runtime.rb:60:in block (2 levels) in require'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/runtime.rb:55:in each' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/runtime.rb:55:in block in require'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/runtime.rb:44:in each' C:/Ruby32-x64/lib/ruby/3.2.0/bundler/runtime.rb:44:in require'
C:/Ruby32-x64/lib/ruby/3.2.0/bundler.rb:187:in require' C:/Users/BHTRD/Desktop/redmine-5.1.2/config/application.rb:18:in <top (required)>'
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:38:in require' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in require'
C:/Users/BHTRD/Desktop/redmine-5.1.2/Rakefile:5:in <top (required)>' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/rake_module.rb:29:in load'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/rake_module.rb:29:in load_rakefile' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:740:in raw_load_rakefile'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:126:in block in load_rakefile' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:214:in standard_exception_handling'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:125:in load_rakefile' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:82:in block in run'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:214:in standard_exception_handling' C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:80:in run'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/rake-13.2.1/exe/rake:27:in <top (required)>' C:/Ruby32-x64/bin/rake:32:in load'
C:/Ruby32-x64/bin/rake:32:in <main>' Bundler Error Backtrace: C:/Users/BHTRD/Desktop/redmine-5.1.2/config/application.rb:18:in <top (required)>'
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:38:in require' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in require'
C:/Users/BHTRD/Desktop/redmine-5.1.2/Rakefile:5:in `<top (required)>'

Caused by:
Incorrect MySQL client library version! This gem was compiled for 10.8.8 but the client library is 3.3.8.
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:38:in require' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in require'
C:/Users/BHTRD/Desktop/redmine-5.1.2/config/application.rb:18:in <top (required)>' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in require'
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:38:in require' C:/Users/BHTRD/Desktop/redmine-5.1.2/Rakefile:5:in <top (required)>'
(See full trace by running task with --trace)

How can i Fix it??

@jwalkerbg
Copy link

jwalkerbg commented May 21, 2024

You may try to install mysql2 gem before installing Redmine. In my case, I use MySQL 5.7. The command to install mysql2 is:

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\Program%20Files\MySQL\MySQL%20Server%205.7\lib" --with-mysql-include="C:\Program%20Files\MySQL\MySQL%20Server%205.7\include" --with-mysql-dir="C:\Program%20Files\MySQL\MySQL%20Server%205.7"'

However, please see #1348 because there is a problem with starting mysql2 gem afterwards. See my comment of how I resolved the problem in my case.

@BraveWhite
Copy link
Author

Thank you for your answer
I'll try it later

@radox83
Copy link

radox83 commented Nov 22, 2024

Hi all, I'm facing the same issue when using RubyMine IDE.

Config: Ruby 3.3.6, Rails 8.0.0, MySQL 8.4.0 and the mysql2 0.5.6 gem.

I get the following error: 'There was an error while trying to load the gem 'mysql2'. (Bundler::GemRequireError)
Gem Load Error is: Incorrect MySQL client library version! This gem was compiled for 10.8.8 but the client library is 3.4.1.'

Any help will be much appreciated, thanks!

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

3 participants