# Ruby for small devices?

**URL:** <https://www.ruby-forum.com/t/ruby-for-small-devices/49892>\
**Category:** Ruby\
**Created:** [December 9, 2005, 6:52pm UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892 "2005-12-09T18:52:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 9, 2005, 6:52pm UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/1 "2005-12-09T18:52:18Z")

</div>

Hello ruby fellows,

I would like to know if anyone has experience with embedding ruby in  
small devices and if such project exists ?

In my current work, I’m using Elphel cameras, mobile phones, etc…  
But ruby is pretty heavy, plus I don’t know if it compiles on ARM or  
other CPUs.

Any hint would be appreciated 🙂

–  
Cheers,  
zimba

> **[oree.ch](http://zimba.oree.ch)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 9, 2005, 7:52pm UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/2 "2005-12-09T19:52:31Z")

</div>

Check out the “Embedding Ruby” presentation from RubyConf 2005:

> **[EmbeddedRuby.pdf](https://www.zenspider.com/dl/rubyconf2005/EmbeddedRuby.pdf)**
>
> 2.69 MB

The stuff you’re interested in starts around page 18, I’d say.

–Wilson.

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 9, 2005, 10:09pm UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/3 "2005-12-09T22:09:36Z")

</div>

> Check out the “Embedding Ruby” presentation from RubyConf 2005:  
> [http://www.zenspider.com/dl/rubyconf2005/EmbeddedRuby.pdf](http://www.zenspider.com/dl/rubyconf2005/EmbeddedRuby.pdf)

Good stuff.

I run Ruby on my iPAQ (I suppose zauri work as well) which has  
a StrongArm 200 MHz (arm v4l)  
32 MB flash, 32 MB RAM

and as in the above presentation, I chopped the stdlibs in a couple of  
packages so I do not carry all the dependencies around. See  
[http://feeds.handhelds.org/ruby/](http://feeds.handhelds.org/ruby/) to get the general idea (polluted with  
some  
apps) and bear in mind that I have 1.8.3 packages cross compiled as well  
(but not uploaded). mm, I also see that my descriptions are a bit too  
much  
copy’n’paste.

Bye,  
Kero.

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 10, 2005, 3:50pm UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/4 "2005-12-10T15:50:35Z")

</div>

Ok, thanks a lot ppl 🙂

Wilson, the paper was a very interesting read. It’s quite funny to see  
what people do with ruby.

Kero, [feeds.handhels.org](http://feeds.handhels.org) seems down for me. Are you sure it’s the right  
domain ?

For more precisions, Elphel cameras[1](http://wiki.elphel.com/) run with an Etrax Axis  
Processor and an FPGA.  
I will look into this during the week.

Cheers,  
zimba

> **[oree.ch](http://zimba.oree.ch)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 10, 2005, 9:02pm UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/5 "2005-12-10T21:02:04Z")

</div>

This is about Smalltalk on small devices, not Ruby, but it may be of  
interest  
[http://www.daimi.au.dk/~marius/documents/andersen2004esug.pdf](http://www.daimi.au.dk/~marius/documents/andersen2004esug.pdf)  
[http://www.smalltalksolutions.com/smalltalksolutions/pdf/Bak.pdf](http://www.smalltalksolutions.com/smalltalksolutions/pdf/Bak.pdf)

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 12, 2005, 9:28am UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/6 "2005-12-12T09:28:09Z")

</div>

I just discovered Scratchbox ([http://scratchbox.org](http://scratchbox.org)) and its awesome for  
cross-compilation of biggish apps.

[ quick overview:

It’s a cross-toolchain for arm and ppc. It’s main ‘wow’ feature  
is that it uses qemu-arm to emulate an ARM host.  
You run ‘/scratchbox/login’ and have root on an emulated ARM, then  
build software.

All the ease of compilation (i.e. you can just run ‘./configure’,  
it ships with an svn client, etc.)  
except an order of magnitude faster (qemu is a bit slow, but i386  
is much faster than arm  
in the first place, so it’s a net win).

For platforms that the emulator isn’t good enough for, you can use  
‘sbrsh’  
to login to the PDA, mount the toolchain and source tree from your  
scratchbox using NFS and build stuff there.

]

Ruby 1.8.3 built with no trouble  
( ext/dl expected a /bin/sh, but a symlink fixed that) and irb, etc runs  
fine  
in the scratchbox. Now i just need to  
copy the files onto my slug where it can run natively.

See the quick howto at:  
[http://scratchbox.org/documentation/user/scratchbox-1.0/html/tutorial.html](http://scratchbox.org/documentation/user/scratchbox-1.0/html/tutorial.html)

- that’s all i needed, just substituted ruby for glib.

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 12, 2005, 9:55am UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/7 "2005-12-12T09:55:22Z")

</div>

> Kero, [feeds.handhels.org](http://feeds.handhels.org) seems down for me. Are you sure it’s the right domain ?

Sorry, that should be  
[Phone Tracker Free | Mobile Tracker | Cell Phone Tracking App](http://handhelds.org/feeds/ruby/)

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 12, 2005, 11:35am UTC](https://www.ruby-forum.com/t/ruby-for-small-devices/49892/8 "2005-12-12T11:35:10Z")

</div>

On 12/9/05, Wilson B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Check out the “Embedding Ruby” presentation from RubyConf 2005:  
> [http://www.zenspider.com/dl/rubyconf2005/EmbeddedRuby.pdf](http://www.zenspider.com/dl/rubyconf2005/EmbeddedRuby.pdf)

The leaking Mutex problem showcased in the presentation page 27, I  
think the following change fixes it at least for #synchronize :

def unlock  
return unless @locked  
Thread.critical = true

- @locked = false  
begin  
t = @waiting.shift

- 

```
 @locked = t # if there is a waiting thread, keep the mutex locked
t.wakeup if t

```

rescue ThreadError  
retry  
end  
Thread.critical = false

# if @locked is false, a thread entering #lock sets Thread.critical=true

here,

# checks for @locked, sees that it’s false, and jumps the queue

```
begin
  t.run if t
rescue ThreadError
end
self

```

end
