Friday, February 3, 2012

typhoeus gem install error

$ sudo gem install typhoeus
ERROR:  Error installing typhoeus:
 ERROR: Failed to build gem native extension.
You need to install typhoeus dependencies:

$ sudo apt-get install curl
$ sudo apt-get install libcurl3 libcurl3-dev
$ sudo gem install typhoeus
  Successfully installed typhoeus-0.3.3
1 gem installed

Saturday, January 28, 2012

Rails to_sentence method

https://github.com/rails/rails/blob/274c3fad5087306a64ca91d044756221f5ff862c/activesupport/lib/active_support/core_ext/array/conversions.rb#L11

no such file to load - readline

When trying to run 'rails c' I got the error below when I installed Ubuntu 11.10:

$ ... no such file to load - readline ...

running the ff. code:
ruby extconf.rb


results to:

$ checking for tgetnum() in -lncurses... yes
$ checking for readline/readline.h... yes
$ checking for readline/history.h... yes
$ checking for readline() in -lreadline... no
$ checking for readline() in -ledit... no
$ checking for editline/readline.h... no


This will fix the readline error:


$ sudo apt-get install libreadline6 libreadline6-dev

$ rvm pkg uninstall readline
$ cd ~/.rvm/src/ruby-1.9.2-p290/ext/readline
$ ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/
$ make
$ make install



Wednesday, June 22, 2011

Rails 3 Error Installing mysql2 gem

 When trying to install mysql2 gem for Rails 3, issuing "bundle install" command


gives me following error "Error installing mysql2: ERROR: Failed to build gem native extension."




The following line should solve the issue:
sudo apt-get install libmysql-ruby libmysqlclient-dev

Wednesday, February 9, 2011

Upstart failing to start MySql

$ service mysql restart
restart: Rejected send message, 1 matched rules; type="method_call", sender=":1.57" (uid=1000 pid=6907 comm="restart) interface="com.ubuntu.Upstart0_6.Job" member="Restart" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))

Just add sudo.

$ sudo service mysql restart
mysql start/running, process 6831

Installing Sphinx in Ubuntu


Installing Sphinx

  1. Download and extract everything from the distribution tarball and go to the sphinx directory:
    $ tar xzvf sphinx-0.9.9.tar.gz
    $ cd sphinx
  2. Run the configuration program:
    $ ./configure
  3. Build the binaries:
    $ make
  4. Install the binaries
    $ make install

Tuesday, February 1, 2011

Error installing mysql gem in Ubuntu

Installing mysql (2.8.1) with native extensions /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/usr/bin/ruby1.8 extconf.rb
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
--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=/usr/bin/ruby1.8
--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

You can fix the above error by issuing the command below:

$ sudo apt-get install libmysqlclient15-dev

Sunday, January 30, 2011

Ruby Memcached Gem on Ubuntu

Got the following error while installing memcached gem:

...
creating Makefile

make
gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/1.8/x86_64-linux -I.  -fPIC  -I/home/gretch/.bundler/tmp/27543/gems/memcached-northscale-0.19.5.4/ext/include  -L/home/gretch/.bundler/tmp/27543/gems/memcached-northscale-0.19.5.4/ext/lib -fno-strict-aliasing -g -g -O2  -fPIC   -fno-strict-aliasing -g -g -O2  -fPIC   -c rlibmemcached_wrap.c
rlibmemcached_wrap.c: In function ‘_wrap_MemcachedSt_sasl_callbacks_set’:
rlibmemcached_wrap.c:6669: error: ‘sasl_callback_t’ undeclared (first use in this function)
rlibmemcached_wrap.c:6669: error: (Each undeclared identifier is reported only once
rlibmemcached_wrap.c:6669: error: for each function it appears in.)
rlibmemcached_wrap.c:6669: error: ‘arg2’ undeclared (first use in this function)
rlibmemcached_wrap.c:6669: error: expected expression before ‘)’ token
rlibmemcached_wrap.c:6687: error: expected expression before ‘)’ token
rlibmemcached_wrap.c:6688: error: ‘struct memcached_st’ has no member named ‘sasl_callbacks’
rlibmemcached_wrap.c:6688: error: expected ‘)’ before ‘const’
rlibmemcached_wrap.c:6688: error: expected ‘;’ before ‘arg2’
rlibmemcached_wrap.c: In function ‘_wrap_MemcachedSt_sasl_callbacks_get’:
rlibmemcached_wrap.c:6700: error: ‘sasl_callback_t’ undeclared (first use in this function)
rlibmemcached_wrap.c:6700: error: ‘result’ undeclared (first use in this function)
rlibmemcached_wrap.c:6711: error: expected expression before ‘)’ token
rlibmemcached_wrap.c:6711: error: ‘struct memcached_st’ has no member named ‘sasl_callbacks’
rlibmemcached_wrap.c: In function ‘_wrap_memcached_set_sasl_callbacks’:
rlibmemcached_wrap.c:12021: error: ‘sasl_callback_t’ undeclared (first use in this function)
rlibmemcached_wrap.c:12021: error: ‘arg2’ undeclared (first use in this function)
rlibmemcached_wrap.c:12021: error: expected expression before ‘)’ token
rlibmemcached_wrap.c:12039: error: expected expression before ‘)’ token
rlibmemcached_wrap.c:12040: error: expected ‘)’ before ‘const’
rlibmemcached_wrap.c:12040: error: expected ‘)’ before ‘arg2’
rlibmemcached_wrap.c: In function ‘_wrap_memcached_get_sasl_callbacks’:
rlibmemcached_wrap.c:12122: error: ‘sasl_callback_t’ undeclared (first use in this function)
rlibmemcached_wrap.c:12122: error: ‘result’ undeclared (first use in this function)
rlibmemcached_wrap.c:12133: error: expected expression before ‘)’ token
rlibmemcached_wrap.c: In function ‘Init_rlibmemcached’:
rlibmemcached_wrap.c:13285: error: ‘SASL_OK’ undeclared (first use in this function)
make: *** [rlibmemcached_wrap.o] Error 1


Gem files will remain installed in /home/gretch/.bundler/tmp/27543/gems/memcached-northscale-0.19.5.4 for inspection.
Results logged to /home/gretch/.bundler/tmp/27543/gems/memcached-northscale-0.19.5.4/ext/gem_make.out
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:446:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:198:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/source.rb:95:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/installer.rb:55:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/installer.rb:44:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/installer.rb:8:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/cli.rb:225:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/vendor/thor/task.rb:22:in `send'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.9/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19

This can be solved by installing:

$ sudo aptitude install libmemcached-dev libsasl2-dev libmemcached-dbg

Wednesday, October 27, 2010

mysql error after upgrading to Lucid Lynx

After I upgraded my Ubuntu machine from Karmic Koala to Lucid Lynx and running my ror app,
I get the following mysql error:

/usr/lib/ruby/gems/1.8/gems/mysql2-0.2.4/lib/mysql2/mysql2.so: libmysqlclient.so.15: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/mysql2-0.2.4/lib/mysql2/mysql2.so (LoadError)

Running this command fixes the error:

$ sudo apt-get install ruby-dev

Sunday, October 3, 2010

Installing Sphinx with MySQL support in Ubuntu Karmic Koala

apt-get install gcc make libmysqlclient15-dev libmysql++-dev


curl -O http://sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz


tar zxvf sphinx-0.9.9
cd sphinx-0.9.9
./configure
make
sudo make install


http://acidborg.wordpress.com/2009/11/22/how-to-install-and-configure-sphinx-in-ubuntu-9-10-with-mysql-support/