08.02.08

(Resolved) Error installing merb on Ubuntu (hint: install ruby-full)

Posted in Ruby, merb at 9:32 am by Robert Horvick

While installing merb I hit the following error:

Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install merb --include-dependencies
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1

Gem files will remain installed in /var/lib/gems/1.8/gems/hpricot-0.6.161 for inspection.
Results logged to /var/lib/gems/1.8/gems/hpricot-0.6.161/ext/fast_xs/gem_make.out

The issue is that compiling extensions requires ruby1.8-dev on Ubuntu.  I installed ruby-full instead using:

> sudo aptitude install ruby-full

And was able to get through the installation without issues (selecting the “ruby” version of each dependency that required a choice).

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

05.31.08

Installing Merb on Windows is a lot easier!

Posted in Ruby, merb, windows at 7:32 pm by Robert Horvick

It’s been a while since I’ve triedthe Merb-on-Windows-from-scratch so I started from and found that it has gottens a lot easier since the last time I tried.

It’s now a two step process:

  1. Install the Ruby One-Click Installer
  2. Follow the instructions on at http://merbivore.com/index.html

But for those of you who want the blow-by-blow account…

  1. Download Ruby One-Click Installer[ruby186-26.exe]
  2. Install - select all defaults.
  3. Run “RubyGems Package Manager”
    1. (Start -> All Programs -> Ruby-186-26 -> RubyGems -> RubyGems Package Manager)
    2. this brings up a command window
  4. - Execute “gem install merb –include-dependencies”
    1. select “1. ParseTree 2.1.1 (i386-mswin32)”
    2. select “1. mongrel 1.1.5 (x86-mswin32-60)
    3. Wait for 10 minutes or so while the rdoc is installed…
  5. Execute: merb-gen app  my_application
  6. Execute: cd my_application
  7. Execute: merb
    1. wait a few moments for it to start up…
  8. open your browser of choice to http://localhost:4000

Success!

I want to extend a major kudos to the folks working on Merb for improving the Merb-on-Windows story so significantly.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

12.19.07

Merb on Cygwin: “No such file or directory - /tmp/mysql.sock” (resolved)

Posted in Ruby, merb at 8:56 pm by Robert Horvick

When trying to perform a migration (rake db:migrate) I hit the following error:

$ rake db:migrate
(in /home/Robert/ruby/merb_apps/blog)
svn: '.' is not a working copy
Connecting to database...
Thu, 20 Dec 2007 01:48:09 GMT: loading gem 'merb_activerecord' from config/dependencies.rb:16 ...
rake aborted!
No such file or directory - /tmp/mysql.sock

(See full trace by running task with --trace)

After a few minutes of googling and some trial/error I discovered that changing “localhost” in the database.yml file to the loop back address 127.0.0.1 resolved the issue. Apparently when you specify an IP address the :socket: value is not needed. Since the default merb database.yml content includes the line:

:socket: /tmp/mysql.sock

This is something that other Windows users may need to modify.

This is my updated config/database.yml file:

:development: &defaults
:adapter: mysql
:database: blog_development
:username: root
:password:
:host: 127.0.0.1

:test:
<<: *defaults
:database: blog_test

:production:
<<: *defaults
:database: blog_production
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Merb on Cygwin: merb_activerecord is not compatible with ActiveSupport 2.0.2

Posted in merb at 8:17 pm by Robert Horvick

If when starting merb you get errors that active support 2.0.1 cannot call activate when active support 2.0.2 is already loaded - this is probably because you are using merb_activerecord which is tied to 2.0.1.

Execute:

$ gem list activesupport

To confirm that you have 2.0.2 and 2.0.1 and, if you desire, resolve the issue with:

$ gem uninstall -v 2.0.2 activesupport
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Merb on Cygwin: Home dir must not be world/group writable

Posted in merb at 7:10 pm by Robert Horvick

When attempting to create a new controller in merb on a cygwin installation I hit the following error:

$ ./script/generate controller post
svn: '.' is not a working copy
/home/Robert is insecure (40777). It may not be group or world writable. Exiting.

Ignore the svn issue for now - I don’t know why script/generate tries to interact with svn but the problem is the home directory permissions.

I believe this is an issue with RubyInline requiring more secure permissions than Ruby itself requires.

To resolve the issue I executed:

$chmod 750 /home/Robert

After that generating the controller worked as expected.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

12.17.07

Manually downloading and installing gems.

Posted in Ruby, merb at 11:57 pm by Robert Horvick

I’m getting ready to dive deeper into merb and wanted to install merb_activerecord. Unfortunately when I tried this I hit the following error:

$ gem install merb_activerecord
Updating metadata for 32 gems from http://gems.rubyforge.org
................................
complete
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
OpenURI::HTTPError: 404 Not Found reading http://gems.rubyforge.org/gems/activesupport-2.0.2-.gem

So I tried “gem update activesupport” and hit the same error.

I went out to the ActiveSupport RubyForge page found that 2.0.2 was released today. So I went to http://gems.rubyforge.org (which redirected to http://gems.rubyforge.vm.bytemark.co.uk/gems) and the latest version available in 2.0.1. So I assume this is just an issue of needing to wait for data to shuffle around.

But I’m impatient.

So I downloaded the gem file from http://rubyforge.org/frs/download.php/29344/activesupport-2.0.2.gem and installed as:

$ gem install activesupport-2.0.2.gem
Successfully installed activesupport-2.0.2
1 gem installed
Installing ri documentation for activesupport-2.0.2...
Installing RDoc documentation for activesupport-2.0.2...

When that was done I was able to successfully install merb_activerecord as follows:

$ gem install merb_activerecord
Successfully installed merb_activerecord-0.4.3
1 gem installed
Installing ri documentation for merb_activerecord-0.4.3...
Installing RDoc documentation for merb_activerecord-0.4.3...

The lessons here are that just-released gems might not be available via “gem install” even though they are a listed dependency of other gems and that manually downloading and installing gems is trivial.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

12.13.07

Getting Merb working on Cygwin requires a Rakefile patch

Posted in Ruby, cygwin, merb at 3:39 pm by Robert Horvick

When getting merb working on Windows I provided a patch to the merb folks that resolved a Rakefile compat problem (sudo was being used even when on Windows - where it does not exist).

I’m trying various configurations on Windows and found that in cygwin the platform name does not include “win32″ so the filter no longer worked (and cygwin does not include sudo).

I filed a ticket http://merb.devjavu.com/ticket/361 and attached the patch. It’s very simple:

$ cat cygwin.diffIndex: Rakefile
===================================================================
--- Rakefile    (revision 1087)
+++ Rakefile    (working copy)
@@ -18,7 +18,7 @@

CLEAN.include ['**/.*.sw?', '*.gem', '.config']

-windows = (PLATFORM =~ /win32/)
+windows = (PLATFORM =~ /win32|cygwin/)

SUDO = windows ? “” : “sudo”

And then it all goes well …

Robert@HORVICKLAPTOP ~/merbsrc
$ rake install
(in /home/Robert/merbsrc)
rake package
(in /home/Robert/merbsrc)
  Successfully built RubyGem
  Name: merb
  Version: 0.4.2
  File: merb-0.4.2.gem
 gem install pkg/merb-0.4.2 --no-rdoc --no-ri
Successfully installed merb-0.4.2
1 gem installed
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

11.17.07

Merb on Windows: It works!!!

Posted in Programming, Ruby, merb at 12:09 am by Robert Horvick

UPDATE: Installing Merb on Windows is now a lot easier!  Check it out here

This post outlines the exact steps I took to get merb working on Windows (to be specific - Vista Home Premium)

  1. Install InstantRails (I have no reason to believe this won’t work with the one-click installer).
  2. Start InstantRails and open a Ruby Console window (the steps following take place in that window)
  3. Execute “gem install hoe”  (RubyInline depends on hoe)
  4. Download http://web.mit.edu/~agp/www/parsetree-win32/ParseTree-2.0.2-mswin32.gem
  5. Download http://web.mit.edu/~agp/www/parsetree-win32/RubyInline-3.6.4.gem
  6. Execute “gem install RubyInline-3.6.4.gem”
  7. Execute “gem install ParseTree-2.0.2.mswin32.gem”
  8. Execute “gem install ruby2ruby”
  9. Execute “gem install json”  (choose json 1.1.1 (mswin32))
  10. Execute “gem install merb -y”
  11. Execute “merb myapp”
  12. Execute “cd myapp”
  13. Execute “set INLINEDIR=c:/temp”  (the slash direction matters!)
  14. Execute “merb”
  15. Browse to http://localhost:4000 and …

Merb Splash Screen

So a big thanks to Ezra for providing the pointers I needed.

Hopefully these steps will prove useful for others.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

11.16.07

Merb on Windows: PEBKAC! (dependency and user error)

Posted in Programming, Ruby, merb at 11:56 pm by Robert Horvick

After my last merb post Ezra left a comment with some concrete suggestions to move forward with getting merb working on Windows.  My next post will cover that exact topic but I wanted to create a post to captute the stack traces of the errors I hit when trying to get merb running.

The first was a dependency issue.  Merb requires json but I did not have it installed.  I think the merb gem should have noted this dependency but honestly I don’t understand gems enough to know for sure.  The output of the merb command and call stack is:

C:\InstantRails\ruby\merb>merb
Merb started with these options:

:query_string_whitelist: []

:reloader: true
:environment: development
:merb_root: C:/InstantRails/ruby/merb
:exception_details: true
:cache_templates: false
:reloader_time: 0.5
:host: 0.0.0.0
:use_mutex: true
:port: “4000″
:session_id_cookie_only: true

Using pure ruby JSON lib
Using pure ruby JSON lib
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load — json/pure (LoadError)
        from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb.rb:28
        from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require’
        from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:236:in `initialize_merb’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:573:in `mongrel_start’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:509:in `run’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/bin/merb:6
        from C:/InstantRails/ruby/bin/merb:16:in `load’
        from C:/InstantRails/ruby/bin/merb:16

I fixed this by installing json 1.1.1 (mswin32).

C:\InstantRails\ruby\merb>gem install json
Select which gem to install for your platform (i386-mswin32)
 1. json 1.1.1 (mswin32)
 2. json 1.1.1 (ruby)
 3. json 1.1.0 (mswin32)
 4. json 1.1.0 (ruby)
 5. Skip this gem
 6. Cancel installation
> 1
Successfully installed json-1.1.1-mswin32
Installing ri documentation for json-1.1.1-mswin32…

No definition for cState_configure

No definition for cState_configure
Installing RDoc documentation for json-1.1.1-mswin32…

No definition for cState_configure

No definition for cState_configure

With the dependencies resolved I re-ran merb but hit another error message.  I’ll give you the output and call stack first and see if you see the problem:

C:\InstantRails\ruby\merb>merb
Merb started with these options:

:query_string_whitelist: []

:reloader: true
:environment: development
:merb_root: C:/InstantRails/ruby/merb
:exception_details: true
:cache_templates: false
:reloader_time: 0.5
:host: 0.0.0.0
:use_mutex: true
:port: “4000″
:session_id_cookie_only: true

C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load — C:/InstantRails/ruby/merb/config/merb_init.rb (LoadError)
        from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:250:in `initialize_merb’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:573:in `mongrel_start’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:509:in `run’
        from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/bin/merb:6
        from C:/InstantRails/ruby/bin/merb:16:in `load’
        from C:/InstantRails/ruby/bin/merb:16

See it yet?

Require failed to find the file C:/InstantRails/ruby/merb/config/merb_init.rb.  But why?

Because I’m an idiot :).  I ran the merb command from the wrong directory.  I needed to move to the application directory at which point I re-ran merb and …

Wait for the next post!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

11.11.07

Merb on Windows: Need to have gcc installed. Forget it … I’m done.

Posted in Programming, Ruby, merb at 2:12 pm by Robert Horvick

[Update: Merb is now working on Windows

Previously I ran into this error when trying to get merb running on Windows:

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:397:in ``': No such file or directory - cl -nologo -LD -Werror  -MD -Zi -O2b2xg- -G6 -I C:/InstantRails/ruby/lib/ruby/1.8/i386-mswin32 -I C:/InstantRails/ruby/include -o "C:/Users/Robert/AppData/Local/Temp/.ruby_inline/Inline_ParseTree_fa12.so" "C:/Users/Robert/AppData/Local/Temp/.ruby_inline/Inline_ParseTree_fa12.c"  -link /LIBPATH:"C:/InstantRails/ruby/lib" /DEFAULTLIB:"msvcrt-ruby18.lib" /INCREMENTAL:no /EXPORT:Init_Inline_ParseTree_fa12 (Errno::ENOENT)
 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:397:in `build'
 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:679:in `inline'
 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ParseTree-2.0.2/lib/parse_tree.rb:243
 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/lib/ruby2ruby.rb:4
 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
  ... 13 levels...
 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:500:in `run'
 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/bin/merb:6
 from C:/InstantRails/ruby/bin/merb:16:in `load'
 from C:/InstantRails/ruby/bin/merb:16

It turns out that merb depends on RubyInline which is the Ruby way to generate C code via Ruby.  Why does it require C code generation?  Honestly I’m not interested enough to continue digging.  I’m not installing gcc on this box.  A quick glance into inline.rb shows that this is a gcc-specific generator and I’m not inclined to spend a day writing the VC interface just to get another step further with merb.

Perhaps I’ll try merb out on my desktop sometime - I dual boot it to Ubuntu - but the point of having it on the laptop was so that I could veg out in bed after the kids were asleep and the wife and I are winding down (and I’m not putting Ubuntu on this machine - Vista is very stable and everything is working how I want it - I’m not going to tempt fate by changing partitions and adding grub).  I know I could remote in to the desktop via any number of protocols but this was just to see what I thought of merb.  I think at this point I’ve figure that out.

Merb looks interesting but has taken, so far, a very unix-centric development turn.  Rails is far more platform neutral and is therefore more compelling to me.

I’ll continue to keep an eye on merb, though.  It looks promising.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

« Previous entries