Been trying to install the mysql2 gem for couple of days, let me tell you where I am stuck and describe the steps I took.
The CMD command that throws an error is: gem install --http-proxy http://web1-proxy:8088 mysql2
!!
Error description:
Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby193/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.
To begin from the start, I installed Ruby 1.9.3, then Rails 4.1.1.
How I installed Ruby:
- From rubyinstaller.org (downloads) I took rubyinstaller-1.9.3-p448.exe
- Checked "Add Ruby executables to your PATH" and "associate .rb and .rbw files with this ruby installation"
- From the same page I installed the Dev Kit (DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe) in C:\RubyDevKit
- I went to RubyDevKit in cmd and typed:
dir dk.rb
ruby dk.rb init
ruby dk.rb install
- I launched irb (typed irb in C:\RubyDevKit) to confirm ruby works and it does.
How I installed rails:
- Went to C:\Ruby193\bin from cmd and typed:
gem install rails
- this threw an error (established connection failed because connected host has failed to respond) which I fixed by going to Internet Options - Connections - LAN Settings - Out of the 4 options, I only checked the last 2 options: Use a proxy server for your LAN (address: web1-proxy, port number given to me by the IT)
- After this I migrated from CMD to "c:\Sites" and typed:
set HTTP_PROXY=http://web1-proxy:8088
- Then: From CMD C:\Ruby193\bin>
gem install --http-proxy http://web1-proxy:8088 rails
- Then: C:\Sites>
rails new app2
- to confirm it works: C:\Sites\app2>
rails server
Installation steps I followed for Mysql:
- From http://dev.mysql.com/downloads/mysql/ (Note: MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries.) Picked the smaller package and RAN the file. During the installation:
- Chose “developer default”
- on the next page agreed to installing pre-requirements (MySql Server, .NET, Connectors etc).
- Config Type = “Development Machine”; I checked: “Enable TCP/IP Networking”, Port number = 3306, checked: Open Firewall port for network access.
- Set MySql root pwd; didn’t add user at this stage
- Windows Service name: MySQL 55, Ran MySQL Server at System startup; Ran Win Service as: Standard System Account
Didn’t start MySql workbench after setup
The ODBC Connector 5.3.2 failed to install during the mysql installation, so afterwards I followed this workaround: http://dev.mysql.com/downloads/connector/ . Clicked on the "Connector/ODBC" link. Made sure "Select Platform" showed "Microsoft Windows". Clicked on the appropriate download button for MSI Installer. After downloading ran the .msi file.
How I debugged my problem so far:
- Copied libmysql.dll from C:\Program Files\MySQL\MySQL Server 5.5\lib to C:\Ruby193\bin and tried again - no luck
- Copied also the libmysql.lib file from C:\Program Files\MySQL\MySQL Server 5.5\lib to C:\Ruby193\bin and tried again - no luck
- Tried
gem install --HTTP-PROXY http://web1-proxy:8088 mysql2 --no-rdoc --no-ri -- '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.6\lib\" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.6\include\"'
- no luck - Tried all 3 of the above solutions with previous versions of mysql installed (using again the installer) and with previous ODBC Connectors.
Help!!