-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MariaDB client version vs. package version error #1348
Comments
New information: I was able to get mysql2 0.5.5 gem to successfully install and work in a running application by using the old 3.1.13 ucrt64 version of the mariadb client. So I think the mariadb client folks changed how the versioning worked out from underneath the mysql2 gem, so you might need to add some extra logic to handle the difference |
I can confirm the issue.
Specifing mysql-dir in which mariadbclient resides, is needed to avoid this error:
|
Thanks @cocco111,
I assuming this means, download the gem source code from github, comment out the 'line' in the source code you referenced and rebuild using:
However, this failed for me with the error:
Any help is greatly appreciated. I am wondering if this is some sort of caching issue or maybe I need to update the version number of the gem for it to work...? |
Hello @Whaat ,
This to avoid starting from source code, that for sure has additional building steps, deps, etc... |
Thanks, but unfortunately that approach does not seem to work. It's OK though I was able to build it now using my original approach. I re-cloned the repo and made sure to checkout the proper release tag (0.5.6). I also made sure to |
@Whaat try this way: |
Same to me. What I did:
My command to install mysql2 is gem install mysql2-0.5.6.gem --platform=ruby -- '--with-mysql-lib="C:\Program%20Files\MySQL\MySQL%20Server%205.7\lib" --with-mysql-include="C:\Program%20Files\MySQL\MySQL%20Server%205.7\include" --with-mysql-dir="C:\Program%20Files\MySQL\MySQL%20Server%205.7"' MySQL is installed at |
open client.c and comment the following line
go to the project root dir and do
copy mysql2-0.5.6.gem to your rails project folder and do
|
Can confirm this issue still appears in mysql2 0.5.6 with Ruby 3.3.3 on Windows. Just like OP, mine was working fine with both 0.5.5 and 0.5.6 and then suddenly stopped, however I think in my case it was related to either upgrading Ruby from 3.2.x and/or upgrading RubyGems in my project. @zawhtutwin 's workaround steps solved the problem in my case. |
@sampenguin I see the issue on both Ruby 3.1 and Ruby 3.3.3.1 on Windows and Linux. It's definitely an issue with the mysql2 gem and how it does version checking which has been messed up now that the libmariadb-client folks changed how their version constants work. |
Sounds to me that CI config using latest Ubuntu with MariaDB libs would help. For some of the CI configs, MySQL proper is fetched rather than using the distro package The OP comment explains how Mariadb is using the constants in a manner that's confusing the check login. I'll see about improving this. On the flip side, this error may be revealing that some folks are using different packages in your CI builds vs prod runtime environments. I urge double checking this as well. There is a high degree of compatibility of MySQL client libraries, but not perfect, which is what I recall (vaguely over the years now) this check was added for. |
Thanks guys @zawhtutwin @chadmyers |
Ruby: 3.1.3.1
Platform: Windows, msys2, mingw64
MariaDB Connector/C version: 3.3.8
mysql2 gem version: 0.5.5
My MariaDB client lib install command:
ridk exec sh -c "pacman -S --needed --noconfirm mingw-w64-x86_64-libmariadbclient"
My Gem install command:
I've also tried with the same effect:
I can successfully gem install/compile the mysql2 gem but when I try to use it, I get the error:
I noticed in mysql2/ext/mysql2/client.c file it has (lines 52-58)
Then (lines 1514 - 1526):
My
msys64\mingw64\include\mysql\mariadb_version.h
file has:MariaDB client's
mysql_get_client_info()
function returns MARIADB_PACKAGE_VERSION, but mysql2 gem is comparing that against theMARIADB_CLIENT_VERSION_STR
.What I don't understand is that this stuff has been there for 3 years, but my mysql2 gem installation only just started breaking within the last 30 days or so. It worked in December when I rebuilt an AMI in AWS using the latest mysql2 gem (0.5.4) and MariaDB client (I think it was 3.3.7 or maybe 3.3.8).
Any thoughts on why this worked and why it's not working now? Thanks in advance!
The text was updated successfully, but these errors were encountered: