Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4631

mysql2 gem is breaking my bundler. An error occurred while installing mysql2 (0.5.5)

$
0
0

I have macbook pro m2 machine. I have a ruby project that was working normally and after doing a system upgrade, It's broken.I'm trying to run bundle install in my project and I'm getting the below error.

An error occurred while installing mysql2 (0.5.5), and Bundler cannot continueFetching gem metadata from https://rubygems.org/.......Installing mysql2 0.5.5 with native extensionsGem::Ext::BuildError: ERROR: Failed to build gem native extension.    current directory: /Users/hazemhagrass/.rvm/gems/ruby-3.2.2/gems/mysql2-0.5.5/ext/mysql2/Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/bin/ruby extconf.rb --with-opt-dir\=/opt/homebrew/opt/zstdchecking 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-----Using --with-openssl-dir=/opt/homebrew/opt/openssl@3----------Using mysql_config at /opt/homebrew/bin/mysql_config-----checking for mysql.h... yeschecking for errmsg.h... yeschecking for SSL_MODE_DISABLED in mysql.h... yeschecking for SSL_MODE_PREFERRED in mysql.h... yeschecking for SSL_MODE_REQUIRED in mysql.h... yeschecking for SSL_MODE_VERIFY_CA in mysql.h... yeschecking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yeschecking for MYSQL.net.vio in mysql.h... yeschecking for MYSQL.net.pvio in mysql.h... nochecking for MYSQL_DEFAULT_AUTH in mysql.h... yeschecking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yeschecking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yeschecking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yeschecking for SERVER_QUERY_WAS_SLOW in mysql.h... yeschecking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yeschecking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yeschecking for my_bool in mysql.h... no-----Setting rpath to /opt/homebrew/Cellar/mysql/8.3.0_1/lib-----creating Makefilecurrent directory: /Users/hazemhagrass/.rvm/gems/ruby-3.2.2/gems/mysql2-0.5.5/ext/mysql2make DESTDIR\= sitearchdir\=./.gem.20240309-60899-3sw70c sitelibdir\=./.gem.20240309-60899-3sw70c cleancurrent directory: /Users/hazemhagrass/.rvm/gems/ruby-3.2.2/gems/mysql2-0.5.5/ext/mysql2make DESTDIR\= sitearchdir\=./.gem.20240309-60899-3sw70c sitelibdir\=./.gem.20240309-60899-3sw70ccompiling client.cIn file included from client.c:15:./mysql_enc_name_to_ruby.h:43:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]mysql2_mysql_enc_name_to_rb_hash (str, len)^./mysql_enc_name_to_ruby.h:86:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]mysql2_mysql_enc_name_to_rb (str, len)^client.c:1438:3: error: call to undeclared function 'mysql_ssl_set'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]  mysql_ssl_set(wrapper->client,  ^client.c:1438:3: note: did you mean 'mysql_close'?/opt/homebrew/Cellar/mysql/8.3.0_1/include/mysql/mysql.h:797:14: note: 'mysql_close' declared herevoid STDCALL mysql_close(MYSQL *sock);             ^2 warnings and 1 error generated.make: *** [client.o] Error 1make failed, exit code 2Gem files will remain installed in /Users/hazemhagrass/.rvm/gems/ruby-3.2.2/gems/mysql2-0.5.5 for inspection.Results logged to /Users/hazemhagrass/.rvm/gems/ruby-3.2.2/extensions/arm64-darwin-23/3.2.0/mysql2-0.5.5/gem_make.out  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:125:in `run'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:51:in `block in make'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in `each'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in `make'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in `build'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:193:in `build_extension'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:227:in `block in build_extensions'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:224:in `each'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:224:in `build_extensions'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:852:in `build_extensions'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:76:in `build_extensions'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in `install'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/source/rubygems.rb:205:in `install'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:54:in `install'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:132:in `do_install'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:123:in `block in worker_pool'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:62:in `apply_func'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:57:in `block in process_queue'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in `loop'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in `process_queue'  /Users/hazemhagrass/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:90:in `block (2 levels) in create_threads'An error occurred while installing mysql2 (0.5.5), and Bundler cannot continue.In Gemfile:mysql2

I could see that it's related to mysql2 package and I followed a lot of tutorials trying to fix it with no solution.

Here are some tips of what I tried before:

  • $ brew install mysql openssl@3 readline zlib libyaml ncurses libffigdbm

  • $ brew install zstd

  • Set environment variables to help the gem find the necessary libraries: Add the following lines to your shell configuration file (.bash_profile, .zshrc, etc.):

  • $ export PATH="/opt/homebrew/bin:$PATH"

  • $ export LDFLAGS="-L$(brew --prefix)/lib -L$(brew --prefix openssl)/lib -L$(brew --prefix zstd)/lib"

  • $ export CPPFLAGS="-I$(brew --prefix)/include -I$(brew --prefix openssl)/include -I$(brew --prefix zstd)/include"

  • $ export PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig:$(brew --prefix zstd)/lib/pkgconfig"

  • rvm install 3.2.2ruby

Caveats:I have access to 3 Linux Ubuntu machines and 2 mac devices. This is happening only with Mac NOT Ubuntu.


Viewing all articles
Browse latest Browse all 4631

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>