-
Notifications
You must be signed in to change notification settings - Fork 549
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 load such file -- mysql2/2.4/mysql2 (LoadError)` #861
Comments
There is no mysql2 binary for Ruby 2.4 for Windows available at this time. You could compile it on your own at this time. At some point in the future I will have this in the public packages, but that will not happen on any immediate schedule. |
@sodabrew .. How can i compile it. Can you please guide me to any tutorial or procedure? |
I'm also having problem in using mysql2 gem in Ruby 2.4. The binary is not listed inside the gem directory, and googling takes me here. I have tried downloading the source code, building the gem by using
The content of mkmf.log file is shown as below:
|
@wjh94. I have the same issue but i have not compile it. I have revert back too ruby 2.3 and used 2.3 mysql2. |
Using Ruby 2.3 is your best bet right now.
|
The 0.5.0 series will include Ruby 2.4 for Windows. |
I have the same issue, my ruby version is 2.2.1. but my os is ubuntu 16.04 |
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check must be called with a valid header file. It is therefore separated from the find_library call.
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check must be called with a valid header file. It is therefore separated from the find_library call.
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check must be called with a valid header file. It is therefore separated from the find_library call.
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check fails, so that it is omitted, now.
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check fails, so that it is omitted, now.
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check fails, so that it is omitted, now.
Is there any ETA as to when this may be resolved, or 0.5.0 may be released? |
+1 Experiencing the same problem. Any updates? |
Same here with Ruby 2.4.1 on Windows 10. Thanks. |
Please can you give an estimated time of when to expect 0.5.0? |
I'm also in the same boat. Using Ruby 2.4 on Windows 10 doesn't work with the MySQL2 gem. Library is missing. |
The next release will be sometime this quarter. So as a workaround until then, I have these suggestions:
|
Worked for me on Ruby 2.4.3 on Windows 10 as shown below. Be sure to get the Mysql server (or) MySQL C connector where it includes lib and include folders. C:\Users\nash\excg>gem install mysql2 --platform=ruby -- '--with-mysql-lib="I:\mysql-5.7.19-winx64\lib" --with-mysql-include="I:\mysql-5.7.19-winx64\include"'
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions with: '--with-mysql-lib="I:\mysql-5.7.19-winx64\lib" --with-mysql-include="I:\mysql-5.7.19-winx64\include"'
This could take a while...
Successfully installed mysql2-0.4.9
Parsing documentation for mysql2-0.4.9
Installing ri documentation for mysql2-0.4.9
Done installing documentation for mysql2 after 1 seconds
1 gem installed |
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes #861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check fails, so that it is omitted, now.
Since RubyInstaller-2.4+ is bundled with MSYS2 and the libmariadbclient can be installed per gemspec library dependency, it is easy to build the mysql2 gem in Windows. The MSYS2/MINGW dependency feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency This also adds ruby-2.4 binaries, so that the mysql2 is still usabel as a binary gem. Fixes brianmario#861 The change in the spec is required for mariadbclient. It throws an error if no query was executed. Due to the stdcall convention on i686, the mysql_query() function check fails, so that it is omitted, now. Signed-off-by: Jun Aruga <[email protected]>
If using nengines solution (compiling yourself) make sure there is no trailing slash at the end of lib dir and at the end of include dir . If there is a slash it will not compile. |
Thank you @nengine That worked for me also. C:\dev\react>gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-5.7.21-winx64\lib" --with-mysql-include="C:\mysql-5.7.21-winx64\include"' |
Sigh well it doesn't work for me.... C:\rails_project\market-tracker>gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector-C-61\lib" --with-mysql-include="C:\mysql-connector-C-61\include"'
C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20180327-9056-1hzh8yu.rb extconf.rb --with-mysql-lib="C:\mysql-connector-C-61\lib" --with-mysql-include="C:\mysql-connector-C-61\include"
|
With mysql2 0.5.0 you can use the Windows binaries for Ruby 2.4 and 2.5 now (remove |
So you're saying just "gem install mysql2" with nothing else? I still get this error when I try to run rspec : Failure/Error: require File.expand_path("../../config/environment", FILE) Gem::LoadError: ./config/environment.rb:4:in `<top (required)>'./spec/spec_helper.rb:64:in `<top (required)>'./spec/routing/scoring_rules_routing_spec.rb:1:in `<top (required)>'--------------------- Caused by: ---Gem::LoadError:can't activate mysql2 (< 0.5, >= 0.3.13), already activated mysql2-0.5.0-x64-mingw32. Make sure all dependencies are added to Gemfile../config/environment.rb:4:in `<top (required)>' |
Yep you'll need an upcoming point release of Rails 5.x to support mysql2 0.5.x as well. Sorry that you're blocked on that now! |
So in order to upgrade Rails and have it run with our application, I need to downgrade ruby to 2.3.x? 'cause I'm not getting these guys to agree to upgrade to Rails 5.x anytime soon. |
Yes, sorry to say, you won't be able to use Rails 4 and mysql2 0.4 and Ruby 2.4/2.5 precompiled. |
This is why Ruby and Rails stayed niche. Python and other language ecosystems weren't broken on Windows. |
I am new on Ruby on Rails. My Ruby version is ruby2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32].
I have created a new project using rails new sample_cms -d mysql command.
The command rails server is throwing following error.
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6-x64-mingw32/lib/mysql2/mysql2.rb:2:inrequire': cannot load such file -- mysql2/2.4/mysql2 (LoadError)`
I have installed mysql and mysql Connector C. I have installed the mysql2 gem like that.
gem install mysql2 —platform=ruby — ‘—with-mysql-dir="C:\Program Files\MySQL\MySQL Connector C 6.1"’
I have uninstall and install the mysql2 gem but still facing the issue. Here is the directory which may have issue.
Here is the gem file entry for mysql2
Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.1'
Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5'
Use Puma as the app server
gem 'puma', '~> 3.7'
Any Help?
The text was updated successfully, but these errors were encountered: