Jump to content

The ultimate community for Ruby on Rails developers.


Photo

How to know the right version of a gem?


  • Please log in to reply
1 reply to this topic

#1 DaveInFL

DaveInFL

    Passenger

  • Members
  • 2 posts

Posted 19 March 2014 - 08:22 PM

How can I determine the correct version of a gem that should be used for a certain version of Ruby and Rails.

 

For example, and bear with me because I am very new to rails, I have ruby 1.9.3 and rails 4.0.2 installed.  In my Gemfile I want to use mysql2 but have no idea what version.  Based upon some tutorial/documentation that I have been reading (which uses SQLite) it states that it is best to specify an exact version to ensure consistency.

 

I just have no idea to determine what the right version of the mysql2 gem should be.  Is there a webpage that states this?

 

TIA.



#2 DaveInFL

DaveInFL

    Passenger

  • Members
  • 2 posts

Posted 19 March 2014 - 08:51 PM

I was able to find that version 0.3.15 is the latest version of mysql2, but not really sure if this is the correct version for ruby 1.9.3 and rails 4.0.2.

Anyway, when I did a bundle update it looks like the install failed. I have copied and pasted the output below. 

Doing some more reading it looks like I will need MySQL installed on my laptop.  Can anyone confirm this? I have a windows laptop that I will be using for development but the actual database will be on a linux box elsewhere.

 

I guess right now I am assuming that I just need to install MySQL to get mysql2 to install, even if I won't be using MySQL on my laptop but rather connecting to a remote MySQL DB. Again, can anyone confirm this?

 

Output from mysql2 install:

 

Installing mysql2 (0.3.15)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=c:/RailsInstaller/Ruby1.9.3/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mygcclib
        --without-mygcclib
        --with-mysqlclientlib
        --without-mysqlclientlib


Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.15), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.15'` succeeds before bundling.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users