When trying to run bundle install to install missing gems for a rails project. It is throwing the error below-
An error occurred while installing mysql2 (0.5.6), and Bundler cannot continue.
In Gemfile:mysql2
I tried deleting the gemfile.lock and also removing the specified version for mysql2 from the Gemfile but the same issue occurs.
The full log is as below-
>bundle installFetching gem metadata from https://rubygems.org/...........Resolving dependencies...Fetching rubyzip 2.4.1Installing mysql2 0.5.6 with native extensionsInstalling rubyzip 2.4.1Gem::Ext::BuildError: ERROR: Failed to build gem native extension.current directory:C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mysql2-0.5.6/ext/mysql2C:/Ruby30-x64/bin/ruby.exe extconf.rbchecking for rb_absint_size()... yeschecking for rb_absint_singlebit_p()... yeschecking for rb_gc_mark_movable()... yeschecking for rb_wait_for_single_fd()... yeschecking for rb_enc_interned_str() in ruby.h... yes*** extconf.rb failed ***Could not create Makefile due to some reason, probably lack of necessarylibraries and/or headers. Check the mkmf.log file for more details. You mayneed 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:/Ruby30-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-mysqlclientlibC:/Ruby30-x64/lib/ruby/3.0.0/mkmf.rb:1050:in `block in find_library': undefinedmethod `split' for nil:NilClass (NoMethodError) from C:/Ruby30-x64/lib/ruby/3.0.0/mkmf.rb:1050:in `collect' from C:/Ruby30-x64/lib/ruby/3.0.0/mkmf.rb:1050:in `find_library' from extconf.rb:131:in `<main>'To see why this extension failed to compile, please check the mkmf.log which canbe found here:C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/mysql2-0.5.6/mkmf.logextconf failed, exit code 1Gem files will remain installed inC:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mysql2-0.5.6 for inspection.Results logged toC:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/mysql2-0.5.6/gem_make.out C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:125:in `run'C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:28:in`build'C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:193:in`build_extension'C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:227:in `blockin build_extensions' C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:224:in `each'C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:224:in`build_extensions'C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/rubygems/installer.rb:844:in`build_extensions'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/rubygems_gem_installer.rb:111:in`build_extensions'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/rubygems_gem_installer.rb:30:in`install'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/source/rubygems.rb:205:in`install'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/installer/gem_installer.rb:55:in`install'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/installer/gem_installer.rb:17:in`install_from_spec'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/installer/parallel_installer.rb:133:in`do_install'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/installer/parallel_installer.rb:124:in`block in worker_pool'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/worker.rb:62:in`apply_func'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/worker.rb:57:in`block in process_queue'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/worker.rb:54:in`loop'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/bundler/worker.rb:54:in`process_queue'C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.5.23/lib/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