Joined: 12 Mar 2005
|Posted: Sun Sep 16, 2018 3:34 pm Post subject: Old Ruby Rails Application MySQL client Lib mismatch [Info]
if you use some rails Applications on Gentoo, without Portage.
And you update your dev-db/mysql-connector-c to Version 6.1.11-r1,
your Ruby on Rails application may fail to start and show an error some error like:
|incorrect MySQL client library version! This gem was compiled for 5.5.39 but the client library is 6.1.11. (RuntimeError) |
Stackoverflow handle the issue here.
Archlinux handle the issue that way.
But the suggested steps, remove and install mysql2 through gem or bundle again did in my case not work. Because i am using rubies packet-manger like gem or bundler to update the rails Applications and used packages.
However and here gentoo join the show: The precompiled packages through gem/bundle did not match the Version i have in use.
Using a higher Version of mysql2 (like 0.5.2) did not work because active record 4.2 needs Version 0.3.21! That is the error that shows up in this case:
|Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). |
The advice to change the Version for mysql2 in the Gemfile will not work because the antiquated application need to stay that way:
|gem ‘mysql2’, ‘~> 0.3.20’ |
Let's solve this, using the dirty way and don't try that at home kids!
to show the storage of the bundle file.
| $ bundle show mysql2 |
2. Unmask dev-ruby/mysql2 and emerge Version =dev-ruby/mysql2-0.3.21
3. Portage install the files in /usr/lib64/ruby/gems/2.3.0/gems/mysql2-0.3.21/lib/ and i just copy the directory "mysql2" and mysql2.rb to that directory where bundle expect the mysql2 files to be stored.
Works like a charm.