Actually I am stuck with this issues and I tried a lot of commands but nothing work
I try to run rails new new_app -d mysql
but when I run bundle
it I get this
current directory: /tmp/bundler20211018-12152-wipksimysql2-0.5.3/gems/mysql2-0.5.3/ext/mysql2
/usr/bin/ruby2.7 -I /usr/local/lib/site_ruby/2.7.0 -r ./siteconf20211018-12152-tsd8v4.rb extconf.rb --with-ldflags\=-L/usr/local/opt/openssl/lib
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... 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=/usr/bin/$(RUBY_BASE_NAME)2.7
--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
/usr/lib/ruby/2.7.0/mkmf.rb:1050:in `block in find_library': undefined method `split' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/2.7.0/mkmf.rb:1050:in `collect'
from /usr/lib/ruby/2.7.0/mkmf.rb:1050:in `find_library'
from extconf.rb:87:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/tmp/bundler20211018-12152-wipksimysql2-0.5.3/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20211018-12152-wipksimysql2-0.5.3/gems/mysql2-0.5.3 for inspection.
Results logged to /tmp/bundler20211018-12152-wipksimysql2-0.5.3/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/gem_make.out
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/builder.rb:92:in `run'
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
/usr/lib/ruby/2.7.0/tempfile.rb:291:in `open'
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/builder.rb:158:in `build_extension'
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/builder.rb:192:in `block in build_extensions'
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/builder.rb:189:in `each'
/usr/local/lib/site_ruby/2.7.0/rubygems/ext/builder.rb:189:in `build_extensions'
/usr/local/lib/site_ruby/2.7.0/rubygems/installer.rb:837:in `build_extensions'
/usr/local/lib/site_ruby/2.7.0/bundler/rubygems_gem_installer.rb:66:in `build_extensions'
/usr/local/lib/site_ruby/2.7.0/bundler/rubygems_gem_installer.rb:26:in `install'
/usr/local/lib/site_ruby/2.7.0/bundler/source/rubygems.rb:199:in `install'
/usr/local/lib/site_ruby/2.7.0/bundler/installer/gem_installer.rb:54:in `install'
/usr/local/lib/site_ruby/2.7.0/bundler/installer/gem_installer.rb:59:in `block in install_with_settings'
/usr/local/lib/site_ruby/2.7.0/bundler/rubygems_integration.rb:558:in `install_with_build_args'
/usr/local/lib/site_ruby/2.7.0/bundler/installer/gem_installer.rb:59:in `install_with_settings'
/usr/local/lib/site_ruby/2.7.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
/usr/local/lib/site_ruby/2.7.0/bundler/installer/parallel_installer.rb:186:in `do_install'
/usr/local/lib/site_ruby/2.7.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
/usr/local/lib/site_ruby/2.7.0/bundler/worker.rb:62:in `apply_func'
/usr/local/lib/site_ruby/2.7.0/bundler/worker.rb:57:in `block in process_queue'
/usr/local/lib/site_ruby/2.7.0/bundler/worker.rb:54:in `loop'
/usr/local/lib/site_ruby/2.7.0/bundler/worker.rb:54:in `process_queue'
/usr/local/lib/site_ruby/2.7.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'
An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue.
In Gemfile:
mysql2
It is my Gemfile inside the new_app file, it's just a half page
ruby '2.7.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.4', '>= 6.1.4.1'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.5'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'