Thursday, February 23, 2012

Installing mysql2 gem on Ubuntu

Issue:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/user/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... 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... yes
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... yes
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
    --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=/home/user/.rvm/rubies/ruby-1.9.2-head/bin/ruby
    --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 /home/user/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.7 for inspection.
Results logged to /home/user/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.3.7), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.7'` succeeds before bundling.

Fix:

sudo apt-get install libmysqlclient-dev

rvm 1.9.2-head gem install mysql2

Monday, February 20, 2012

Sunspot issue - You need a Java Runtime Environment to run the Solr server

C:\Users\project1>rake sunspot:solr:run --trace
DEPRECATED! (configure_from_yaml) Please stop using YAML and use Ruby instead. T
his method will be removed in 2.9.
** Invoke sunspot:solr:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:run
The syntax of the command is incorrect.
rake aborted!
You need a Java Runtime Environment to run the Solr server

Fix:
Modify C:\Ruby192\lib\ruby\gems\1.9.1\gems\sunspot_solr-1.3.0\lib\sunspot\solr\java.rb file with

module Sunspot
  module Solr
    module Java
      def self.installed?
          true
      end
    end
  end
end

Also make sure your gemfile has:

gem 'sunspot_rails'
# This is an optional packaged Solr:
group :test, :development do
  gem 'sunspot_solr'
end

Reference Links:
https://github.com/sunspot/sunspot/issues/147

Monday, February 13, 2012

Useful links to install redis on windows

Download and install:
https://github.com/rgl/redis/downloads
References:
https://github.com/dmajkic/redis http://redis.io/documentation
You may need this as well:
http://www.mingw.org/wiki/Getting_Started http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20111118/