Error When Trying to Install App With MySQL2 Gem

Error when trying to install app with mysql2 gem

The error log says:

ld: library not found for -lssl

So, you need to install libssl:

brew install openssl

As it was pointed out in comments, there might be a need to export the path to the library.

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

Ruby gem mysql2 install error

Since this keeps coming up on google as on of the top results, I should point out that this answers is from almost 2 years ago. Here is a more updated answer: How to use "mysql2" gem in Rails 3 application on Windows 7?


According to the developer there is a already a reported bug for it and he is working on parting mysql2 over to Windows. As of now - it's still in the works. Use the older mysql driver for now - or use sqlite for local development.

This is from the googlegroups discussion

Blockquote
Hey Erwann,
There's a ticket on the mysql2 issue tracker for Win32 support already
at http://github.com/brianmario/mysql2/issues#issue/8 . You can follow
it for progress; I'm doing my best to get things working smoothly for
you guys. Hang tight! :)

An error occurred while installing mysql2 (0.5.4), and Bundler cannot continue - in rails project

It is an open issue with mysql2 though there is a workaround. Check this thread from GitHub the last comment is the thing you need.

Cannot install mysql2 gem

I finally solved it:

  1. Downloaded and installed MySQL 64bit version 5.5
  2. Downloaded the zip archive for the 32bit version 5.5.
  3. Extracted the 32-bit include and lib folders to C:\MySQL.
  4. Installed Ruby 1.9.2.
  5. Installed the Ruby Devkit.
  6. Installed the gems:
    1. gem install mysql
    2. gem install mysql2 -- --with-mysql-lib=C:\MySQL\lib --with-mysql-include=C:\MySQL\include
    3. gem install rails
    4. gem install fastthread
    5. gem install haml

It's working as a charm now. It seems the MySQL gem has issues finding the data when dealing with 64-bit.

ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3)

I ended up just installing a fresh copy of MySQL and not using MAMP and that did the trick. Also had to be sure to install the 64-bit version, not 32-bit.

Unable to install MySQL2 gem on Windows 7

The specific version of mysql2 gem you're trying to install (0.2.4) not only lacks binaries for Windows, but have issues on Windows.

Please install mysql2 gem without indicating the version:

gem install mysql2

Which will install latest version (0.2.6 at the time of my posting this) and also provides binaries for Windows which skip the compilation step.

If you still want to force the compilation (because your version of MySQL differs from the one used to generate the binary gem, you will need to install RubyInstaller's DevKit from RubyInstaller website:

http://rubyinstaller.org/downloads

And follow the DevKit installation instructions from our wiki (that is linked from the download page)

You will need to provide the path to both headers and libraries during the gem installation process, and adjust the MySQL installation location from the following instructions:

subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.1" 
gem install mysql2 --platform=ruby -- --with-mysql-dir=X: --with-mysql-lib=X:\lib\opt
subst X: /D

The above command uses subst to avoid issues with path with spaces, which you should avoid always.

Hope this helps.

Error installing mysql2 gem

Here are several possibilities you could try.

  1. Try adding --platform=ruby to your command. I've seen that people claim it helps.

    Your command should then be:

    gem install mysql2 --platform=ruby --version 0.2.7 -- --with-mysql-dir=/Applications/XAMPP/xamppfiles/ --with-mysql-lib=/Applications/XAMPP/xamppfiles/lib/mysql/ –with-mysql-include=/Applications/XAMPP/xamppfiles/include/mysql/ --with-mysql-config=/Applications/XAMPP/xamppfiles/bin/mysql_config
  2. Make sure you are building for the correct architecture. OSX 10.6.x is very vague about when it uses 32-bit stuff and when it uses 64-bit stuff, at least as far as I can tell.

    You need to try building against both 32 and 64 bit versions of MySQL.

    The simplest way to do it is to download both of them from http://dev.mysql.com/downloads/mysql/#downloads and try to build against each one.



Related Topics



Leave a reply



Submit