# Ruby on WinCE / cegcc

**URL:** <https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776>\
**Category:** Ruby\
**Created:** [February 21, 2008, 12:41pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776 "2008-02-21T12:41:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 21, 2008, 12:41pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/1 "2008-02-21T12:41:10Z")

</div>

I’m trying to get Ruby up and running on an ARM-based Windows CE device  
(Pocket PC 2003 and Windows Mobile 5 pda devices). The pre-built  
binaries on [ruby-mswince](http://uema2.s8.xrea.com/ruby-mswince/) don’t work very well  
for anything other than the simplest of code - ie anything with a  
‘require’ is toast, as relative paths do not work; so anything relying  
on gems (even gems itself!) is no good.

Has anyone attempted to get Ruby running using the Windows CE cross  
development tools ([http://cegcc.sourceforge.net/](http://cegcc.sourceforge.net/)) for Cygwin/Linux? This  
could be a better solution as I believe thay have implemented some sort  
of relative path system in their ‘newlib’ libc replacement.

Using the arm-wince-cegcc toolset I can seemingly configure the code ok  
using:

CC=/opt/cegcc/bin/arm-wince-cegcc-gcc.exe   
CPP=/opt/cegcc/bin/arm-wince-cegcc-cpp.exe   
LIBS=“-I/opt/cegcc/include”   
LDFLAGS=“-L/opt/cegcc/lib”   
./configure --host=arm-wince --prefix=/WinCE/built

… and then get part way into the build process (up to ext/bigdecimal)  
but then it throws up dozens of undefined references when trying to  
link… I guess I need to build a load of other arm-wince native  
libraries as well?

Is this worthwhile? The dozens of other questions about ruby on  
wince/pocket pc all have the same problems (wince:strerror or the path  
problems), so some kind of solution is needed.

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 22, 2008, 12:22am UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/2 "2008-02-22T00:22:27Z")

</div>

John S. wrote:

> Is this worthwhile? The dozens of other questions about ruby on  
> wince/pocket pc all have the same problems (wince:strerror or the path  
> problems), so some kind of solution is needed.

Ok, so after spending a whole day on this I actually got the latest  
version of Ruby (1.8.6-p111) to compile using the arm-wince-cegcc  
toolchain and run on a Windows Mobile 5 device. It also doesn’t spit out  
the wince::strerror, so good news there.

However, the relative path problem is still there - I thought the extra  
stuff in newlib from the cegcc project may have gone some way to  
alleviating it, but as of now it’s still unuseable for all but the most  
trivial of code (can you imagine modifying all of the files that a  
framework like Rails uses, so that everything was absolute?).

Don’t think by having a running ruby binary that you’ll be installing  
gems, left right and centre, or firing up a Rails app any time soon ☹

If anyone is interested, I’ll put a web page up on a system at work to  
allow others to use it. I’ll also document the modifications needed in  
order to compile cleanly.

Looks like a dead end for my intentions of Ruby on WinCE/Pocket PC  
though, unless someone can figure out a workaround for the Windows CE  
path problem?

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 23, 2008, 6:44pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/3 "2008-02-23T18:44:00Z")

</div>

John S. wrote:

> John S. wrote:
> 
> > Is this worthwhile? The dozens of other questions about ruby on  
> > wince/pocket pc all have the same problems (wince:strerror or the path  
> > problems), so some kind of solution is needed.
> 
> …
> 
> If anyone is interested, I’ll put a web page up on a system at work to  
> allow others to use it. I’ll also document the modifications needed in  
> order to compile cleanly.
> 
> Looks like a dead end for my intentions of Ruby on WinCE/Pocket PC  
> though, unless someone can figure out a workaround for the Windows CE  
> path problem?

Ok, so I’ve documented what I’ve done so far, and I’ve also put up  
pre-built binaries of the latest stable version of Ruby for Windows CE  
/ARM for anyone who is interested.

I have _almost_ got Rubygems to install, but I fail on requiring  
‘socket’… which is one module (along with ext/dl) that I couldn’t  
manage to build cleanly.

When doing the final linking of ruby, I get a single unresolved symbol  
from ext/socket/socket.a; “\_\_h\_errno\_location”.

I managed to fix all of the other symbol errors and multiple  
declarations, but this one still eludes me; and I cannot see it anywhere  
in the CEGCC libraries. If anyone has any further information, the full  
error is on my website along with the rest of the build information.

[http://www.target-earth.net/gadgets/](http://www.target-earth.net/gadgets/)

Sorry there are no patches as such, but everything I have done is  
detailed - this definitely seems the way to go if we can get patches  
into the official codebase to handle a compile time option for the CEGCC  
build.

-John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 24, 2008, 12:41am UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/4 "2008-02-24T00:41:46Z")

</div>

On Sun, Feb 24, 2008 at 9:44 AM, Dominik H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> And lets be honest: Rails isnt something you run on a WinCE device, is it?

There goes my super-portable website idea! ☹ Oh well. 🙂

Dominik H.

Arlen

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 24, 2008, 5:31pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/5 "2008-02-24T17:31:14Z")

</div>

Arlen C. wrote:

> On Sun, Feb 24, 2008 at 9:44 AM, Dominik H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > And lets be honest: Rails isnt something you run on a WinCE device, is it?
> 
> There goes my super-portable website idea! ☹ Oh well. 🙂
> 
> Dominik H.
> 
> Arlen

No need to be so sad 😉

with the help of someone on the cegcc-devel list, I may have just gotten  
the socket extensions working 🙂

I can now do both a ‘require socket’ and ‘require webrick’ in irb  
without Ruby having a fit!

Hopefully a I’ll have a proper patch coming soon.

-John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 23, 2008, 11:45pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/6 "2008-02-23T23:45:58Z")

</div>

On [Sun, 24.02.2008 02:43], John S. wrote:

> > allow others to use it. I’ll also document the modifications needed in  
> > I have _almost_ got Rubygems to install, but I fail on requiring
> 
> [http://www.target-earth.net/gadgets/](http://www.target-earth.net/gadgets/)
> 
> Sorry there are no patches as such, but everything I have done is  
> detailed - this definitely seems the way to go if we can get patches  
> into the official codebase to handle a compile time option for the CEGCC  
> build.
> 
> ## -John
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Thanks so far, finally a binary for the ARM/WinCE platform.  
Just sad to hear, that WinCE cant handle relative pathes, but for small  
tools  
(like calculators or whatsoever) it might be still useful.  
And lets be honest: Rails isnt something you run on a WinCE device, is  
it?

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 24, 2008, 10:39pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/7 "2008-02-24T22:39:11Z")

</div>

John S. wrote:

> I’ve built another release; this time the socket library built cleanly  
> with a modification to use liberrno from CEGCC. I can now do a ‘require  
> webrick’ and even install rubygem! (although I get an error right at the  
> end when it’s trying to install ri docs)

I’ve done further testing and the patched socket extension actually  
works - at least at a localhost level! Wow, I’ve really surprised  
_myself_ now!.

[http://www.target-earth.net/gadgets/code/rubyce.html#sockets](http://www.target-earth.net/gadgets/code/rubyce.html#sockets)

This could well mean that bigger, more complicated packages are not far  
away from running! 😉

As a treat for you all, I’ve replaced the previous binaries on my site  
with a new set that were compiled with -O3 optimisation; definitely  
quicker. If anyone can report on how well these run on a physical device  
that would be appreciated!

-John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [March 1, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/8 "2008-03-01T19:11:19Z")

</div>

I’ve done some further work on the Ruby Arm-WinCE-CEGCC port this week:

[http://www.target-earth.net/gadgets/code/rubyce.html#regression](http://www.target-earth.net/gadgets/code/rubyce.html#regression)

Some bad news; Gem just doesn’t seem to work right and I’m still a  
little way from getting a Rails instance running.

Good news is that I’m gradually copying the regression tests from the  
Ruby source over to a Windows CE style of absolute path names where  
requires (mostly local ‘require’ directives) and I’m pleasantly  
surprised at the amount of tests that pass without error. Once they’re  
all converted I’ll put up an archive that other Ruby on Arm-WinCE-CEGCC  
users can overlay on their installations.

There _are_ quite a few tests that fail however, and I’m sure that these  
will be causing problems somewhere along the line.

I also have a suspicion that in certain areas the low memory environment  
is causing problems. Very little I can do about that, other than look at  
a dynamic version of Ruby… something I’ve only just started on  
(libz.dll is built, but openssl is proving trickier).

-John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [March 5, 2008, 8:19pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/9 "2008-03-05T20:19:04Z")

</div>

Just wanted to let you know that people still are reading this thread  
and that you shouldnt give up your good work.

You are on a good way to more and more ruby power on the WinCE platform.

Thanks again!

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 24, 2008, 7:41pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/10 "2008-02-24T19:41:53Z")

</div>

I’ve built another release; this time the socket library built cleanly  
with a modification to use liberrno from CEGCC. I can now do a ‘require  
webrick’ and even install rubygem! (although I get an error right at the  
end when it’s trying to install ri docs)

[http://www.target-earth.net/gadgets/](http://www.target-earth.net/gadgets/)

There is a new file on my site (dated 24 Feb 2008) including a pre-built  
binary version, along with a pre-installed version of rubygem.

I should have a proper patch soon… it’s just working out how to build  
this external library at the same time and include it in the final  
linking process. The rest of the modifications against the plain Ruby  
source tree now work cleanly with a single patch.

-John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [March 10, 2008, 9:43am UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/11 "2008-03-10T09:43:54Z")

</div>

Mike S. wrote:

> Thanks, John!  
> It’s great to have 1.8.6 working on my iPAQ 4150.
> 
> Thanks again.  
> Mike S.
> 
> John S. Ð¿Ð¸ÑˆÐµÑ‚:

Thanks Dominik and Mike, it’s great to hear positive feedback - I’ve had  
no-one contact me so I didn’t even know if people had tried this  
version.

Anyway, I have done a little more work - at one point I managed to get  
ruby and all of the extensions to build dynamically; the size was  
reduced dramatically. I also managed to build a dll version of libz  
which the extension for ruby correctly linked against. Couldn’t manage  
the same for OpenSSL yet though, which results in the ruby openssl  
extensions being around 500Kbytes in size with the statically linked  
libssl and libcrypto libraries.

One problem is that the actual dynamic ruby binary wouldn’t run on the  
device. That’s something I’m going to have to investigate further.

On a more positive note, I would say that approximately 60-70% of the  
ruby regression tests work with only minor edits (mostly where they do  
local ‘requires’ for test files). It’s the others that need looking at -  
test\_imap.rb for example gives the ‘cannot allocate memory’ problem.

-John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [March 7, 2008, 10:48pm UTC](https://www.ruby-forum.com/t/ruby-on-wince-cegcc/129776/12 "2008-03-07T22:48:45Z")

</div>

Thanks, John!  
It’s great to have 1.8.6 working on my iPAQ 4150.

Thanks again.  
Mike S.

John S. Ð¿Ð¸ÑˆÐµÑ‚:
