-
Notifications
You must be signed in to change notification settings - Fork 548
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
Cannot install mysql2 gem on Windows 10 #1210
Comments
For anyone who is interested, i was able to get this to install from the rubygems.org directly after passing the path to the c bindings but this won’t install via bundler specifying a git url with this error. I can’t tell if the rubygems site matches the github repo but seems to work now, |
Hi yeah I found that guide but it wasn't working in Bundler as it refused to take the arguments from the .bundle file. Worked fine installing directly outside of Bundler though, which I was able to do. 👍 |
I got this exact same error in the same line 1771. After an entire day of trial and error, I found that I could install a working*
FWIW, I could get a non functional gem to build with the C Connector 6.1.11 by doing so:
Also note that I tried to build with I have also noticed to that a consistent predictor of a failed build is the second line that starts with Hope this helps |
@pcopissa's solution put me on the right track, except I wanted to use the MariaDB library.
The gem compiled, although I haven't tested it yet, so I have yet to see if it works ¯\_(ツ)_/¯ |
I was able to get this working on OSX by (note this assumes Homebrew is installed):
Note that I happened to do the uninstall/reinstall of mariadb but a I'm also not sure if there's a better way to specify the 'mysql_dir' when in installing the gem. Brew creates symlinks to the executables but I didn't find any links to the root 'Cellar/mariadb/[version]' dir. I suppose one could be added manually (and updated as needed). |
Only these Two commands works for me.
Thank you @pcopissa |
Same for me on W2016 with Ruby v2.7.7 |
Thanks @pcopissa I tried many other methods over the last 2 days. Open cmd C:\Windows\System32>ridk large printout of Ruby Installer 2 for Windows C:\Windows\System32>gem install mysql2 --platform=ruby -- --with-mysql-dir=c:/Ruby32/msys32/mingw32 Temporarily enhancing PATH for MSYS/MINGW... Nearly fell off my chair when it worked. Please note that DevKit needs to be down loaded and need to ensure that all 3 options are installed |
C:\Windows\System32>gem install mysql2 --platform=ruby -- --with-mysql-dir=c:/Ruby32/msys32/mingw32 This works but does anybody know why? Pointing the mysql dir to Ruby dir is the lasts thing I would have thought would work. Am I misinterpreting what that flag is for? I thought it was the pat to MySQL |
Start cmd terminal and run ridk From that cmd, run gem install mysql2 --platform=ruby -- --with-mysql-dir=c:/Ruby32-x64/msys64/mingw64 |
@pcopissa |
work using this command on windows 11 and ruby 3.1.4. thanks |
The answer is twofold, I think: First, MSYS2 does not have a MySQL package, but a MariaDB one and they are sufficiently similar header-wise and symbol-wise (I assume that's deliberate ?) that you can use use MariaDB's stuff instead of MySQL's. Hence I just installed the MariaDB package for MSYS2 (that ends up in the standard folders under Unix |
I tried my best to contact MySQL devs to support MINGW package, yet done it: |
I've just managed to install
|
Thanks, it works for me |
Unfortunately, this doesn't work 🙁
Further check, I found following the steps on #1348 (comment), we need to perform additional steps like this
To verify it:
|
: this worked for me thank you!!! |
Hi there. I'm trying to install this gem into my Ruby installation (Ruby 2.7.4, via msys2, x64-mingw32: Windows 10 v2004) but no matter what I attempt to do, I get this error consistently:
Any ideas on how to fix, or is the latest gem version non functional at the moment? I've confirmed that I have the required system libraries present and I've even tried, as per the error message, to point the gem to use the locally installed MariaDB 10.4, but nothing works. Help would be appreciated.
The text was updated successfully, but these errors were encountered: