ruby gems private method specification_version problem

/usr/lib/ruby/1.8/rubygems/source_index.rb:86:in `load_specification': private method `specification_version=' called for # (NoMethodError)
        from /usr/lib/ruby/1.8/rubygems/specification.rb:401:in `initialize'
        from (eval):1:in `new'
        from (eval):1:in `load_specification'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:121:in `eval'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:86:in `load_specification'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:121:in `load_gems_in'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:120:in `each'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:120:in `load_gems_in'
         ... 8 levels...

Try

ruby -v

because you probably have 1.8.x. If so, install ruby 1.9 and execute the code with it.

Unfortunately in ubuntu there seems to be a problem with the packages dependency. If you install rubygems package you get ruby1.8 also. The solution is to run the code explicitly with “ruby1.9” instead of “ruby” or for your own responsibility:

rm /usr/bin/ruby
ln -s /usr/bin/ruby1.9 /usr/bin/ruby

You may then get a:

/usr/bin/gem:9:in `require': no such file to load -- rubygems (LoadError)
        from /usr/bin/gem:9

This is because ruby1.8 had the gems installed, not 1.9. You can check that through:

locate rubygems.rb

The solution is to install gems for ruby1.9 as well. But there is another problem, The ruby1.9 has no complete rake installed.

So the best thing to do in my opinion is not waste time and do something like:

apt-get remove ruby ruby1.9 ruby1.8 rubygems rake
cd /opt/install
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-5.tar.bz2
tar -xf ruby-1.9.0-5.tar.bz2
cd ruby-1.9.0-5
./configure --prefix="/opt/ruby1.9"
make
make install

And then setup your $PATH, edit .bashrc or whatever (.profile, …) and place the parth to /opt/ruby1.9/bin dir in it.

export GEM_HOME=$HOME/opt/gems
export GEM_PATH=$HOME/opt/gems/gems
export PATH=$PATH:/opt/ruby1.9/bin

This worked for me.

You can also have a look at: /2009/06/08/ruby-1-8-6-in-ubuntu-9-04-64-minimal

Posted by wojtek Tue, 11 Nov 2008 13:11:00 GMT




rmagick install invalid character problem

Problem:

/home/wojtek/opt/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/site_ruby/
1.8/rubygems/custom_require.rb:27:
 /var/lib/gems/1.8/gems/rmagick-2.5.2/lib/RMagick2.so:1: 
Invalid char `\177' ('') in expression (SyntaxError)

Solution:

You have messed up something with (probably in your NetBeans) with JRuby vs Ruby configuration. Check your “Tools->Ruby platforms” etc configuration. Then check in project “Properties->Run”.

Posted by wojtek Mon, 25 Aug 2008 20:41:00 GMT




typo migration problem

Problem:

 Migrating Typo's database to newest release
== 67 RemoveBlogIds: migrating =========
-- remove_index(:contents, :blog_id)
-- remove_column(:contents, :blog_id)
rake aborted!
SQLite3::SQLException: table contents has no column named blog_id: 
CREATE  INDEX "altered_contents_blog_id_index" ON contents ("blog_id")

(See full trace by running task with --trace)
/home/user/www/.ruby/gems/1.8/gems/typo-5.0.3.98.1/bin/typo:59:
in `migrate': Migration failed (RailsInstaller::InstallFailed)
(...)

Solution:

Login to your typo database, for example:

sqlite3 db/database.databse

and do:

drop index altered_contents_blog_id_index

Posted by wojtek Tue, 19 Aug 2008 11:23:00 GMT




typo new version problem

Problem:

 Making scripts executable
 Checking database
 Creating initial database
 Creating MySQL database
ERROR 2002 (HY000): 
Can't connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (2)
ERROR 2002 (HY000): 
Can't connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (2)
 expanding lighttpd.conf.example template
 expanding apache20.conf.example template
 expanding apache13.conf.example template
 Migrating Typo's database to newest release
rake aborted!
Can't connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (2)

(See full trace by running task with --trace)
/home/user/www/.ruby/gems/1.8/gems/typo-5.1.2/bin/typo:59:in `migrate': 
Migration failed (RailsInstaller::InstallFailed)

Solution:

Edit your typo gem installer file, it can be located for example in:

~/.ruby/gems/1.8/gems/typo-5.1.2/installer/rails_installer_defaults.yml
c:\Programs\ruby\lib\ruby\gems\1.8\gems\typo-5.1.2\installer\rails_installer_defaults.yml 

and change “mysql” to “sqlite”.

Posted by wojtek Mon, 18 Aug 2008 14:52:00 GMT




RMagick JPEG and PNG reading problem

When installing ImageMagic for RMagick from source I got then:

in `read': no decode delegate for this image format 
`/img/letters100x100.png' (Magick::ImageMagickError)

or

in `read': no decode delegate for this image format 
`/img/taj_orig.jpg' (Magick::ImageMagickError)

The solution is to install these things and rebuild ImageMagick:

apt-get install libjpeg62-dev
apt-get install libpng3

#rebuild
./configure --disable-static --with-modules --without-perl \
--without-magick-plus-plus --with-quantum-depth=8
make
make install

Posted by wojtek Sun, 04 May 2008 21:30:00 GMT




RMagick shared libraries problem

Problem:

/var/lib/gems/1.8/gems/rmagick-2.3.0/lib/RMagick2.so:
libMagickCore.so.1: cannot open shared object file:
No such file or directory -
/var/lib/gems/1.8/gems/rmagick-2.3.0/lib/RMagick2.so (LoadError)

Not very elegant temporary solution (fortunetly the one working on my OS):

cd /lib
ln -s /usr/local/lib/libMagickWand.so.1
ln -s /usr/local/lib/libMagickCore.so.1

This DOES NOT work:

echo -e "\n/usr/local/lib" >> /etc/ld.so.conf.d/i486-linux-gnu

Posted by wojtek Sun, 04 May 2008 21:25:00 GMT




Problem with building gems

Problem:

no such file to load -- mkmf (LoadError)

Solution:

apt-get install ruby1.8-dev

Posted by wojtek Sun, 04 May 2008 21:22:00 GMT




Custom GEM_HOME setup problem

Problem:

/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require':
no such file to load -- sources (LoadError)

Solution:

wget http://rubyforge.org/frs/download.php/26579/sources-0.0.1.gem
gem install --local sources-0.0.1.gem 

Posted by wojtek Sun, 04 May 2008 21:16:00 GMT