Bundle install failed for mysql2 gem

63 Views Asked by At

I updated my local machine mysql from 5.7 to 8 and after installing it couldn't install DB Adapter mysql2 gem via bundle install command.

However, i am able to install it with the following command.

gem install mysql2 -v '0.5.5' -- --with-mysql-lib=/opt/homebrew/opt/[email protected]/lib --with-mysql-dir=/opt/homebrew/opt/[email protected] --with-mysql-config=/opt/homebrew/opt/[email protected]/bin/mysql_config --with-mysql-include=/opt/homebrew/opt/[email protected]/include --with-ldflags="-L$(brew --prefix zstd)/lib -L$(brew --prefix [email protected])/lib -L$(brew --prefix zlib)/lib" --with-cppflags="-I$(brew --prefix [email protected])/include -I$(brew --prefix zlib)/include"

it installs successfully

This could take a while...
Successfully installed mysql2-0.5.5
Parsing documentation for mysql2-0.5.5
Done installing documentation for mysql2 after 0 seconds
1 gem installed

but when tried running tests it says

Could not find gem 'mysql2 (= 0.5.5)' in any of the gem sources listed in your Gemfile.

so i try bundle install and it fails with

38 warnings generated.
linking shared-object mysql2/mysql2.bundle
ld: warning: -multiply_defined is obsolete
ld: library 'zstd' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1

An error occurred while installing mysql2 (0.5.5), and Bundler cannot continue. Make sure that gem install mysql2 -v '0.5.5' succeeds before bundling.

Background: After updating when i tried running the test, it was searching for some path of [email protected] inside /vendor/mysql2-0.5.5/ directory so i tried uninstalling this gem but after that it couldn't install again.

Ruby version: 2.5.8

Rails version: 2.318 (I know its really old :( )

0

There are 0 best solutions below