Ruby for Windows Mobile (Win CE, CeGCC)

M

Maxim Sokolovsky

Hi,
I'm spent countless time in searching working ruby port on Windows
Mobile. I'm not a fan of this OS, but already have device with it and
still want to try programming in ruby on it. Google kicked me to:

1. Howto compile and binaries ruby 1.8.x with Microsoft Visual Embedded
C++ ( http://uema2.s8.xrea.com/ruby-mswince/ ). This works fine, but
first of all it has Windows Mobile restriction on relative paths (ex.
requiring 'lib/some.rb" - fails) and in addition it is 1.8 - not 1.9.
There is no chance to use it as full value port, especially with
rubygems.

2. Success story of compiling ruby 1.8 with CeGCC cross compile
toolchain ( http://cegcc.sourceforge.net/ ). Here is the topic of John
Snowdon aka smed: http://www.ruby-forum.com/topic/143475 . He
successfully compiled ruby 1.8 even with rubygems (!). But for my sorry
I can't reproduce his success and his blog with binaries is down too (
http://www.target-earth.net/gadgets/code/rubyce.html ). In addition it
is 1.8 branch and it will be more likely to use 1.9.x :p

So, i'm trying to compile ruby 1.9.1 p429 with CeGCC 0.59.1 under
Ubuntu 10.04. First trouble that I get - is that confuigure script can't
verify setpgrp() while cross-compiling. I solve it by adding
"ac_cv_func_setpgrp_void=yes" to args. Next trouble was that configure
script cannot detect pthread_kill function in any header, so it suggest
not to use native threads, but in 1.9.x native threads - are mandatory.
Some search kick me to mail list with howto compile pthreads-win32 (
http://sourceware.org/ml/pthreads-win32/ ) with mingw32ce (mingw32 part
of cegcc). I reproduced his success and now i have .dll, .a and headers.
First my question is - can I it ( library compiled with mingw32ce) in
compiling with cegcc? I'm novice in cross compiling and it would be
greate if someone can hint how do I use it in compilng: some extra
environment variable, makefile edits or maybe i can add some args to
configure script? I think i choose dirty incorrect way, trying to hack
makefile and sources in order to bypass errors. I added
"-I/path/to/pthreads" to optflags variable in Makefile. I'm compiling
with this environment:
ruby sources is in: /var/tmp/ruby-1.9.1-p429
pthreads-win32 sources, library file(.a) and its dll in:
/var/tmp/pthreads-w32-2-8-0-release
cegcc is in: /opt/cegcc
mingw32ce is in: /opt/mingw32ce

this is my PATH env variable:
/opt/mingw32ce/bin:/opt/cegcc/bin:/opt/cegcc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/android-sdk-linux_86/tools

and this is line with which i'm compiling:
CC=arm-cegcc-gcc CPP=arm-cegcc-cpp AR=arm-cegcc-ar AS=arm-cegcc-as
OBJCOPY=arm-cegcc-objcopy OBJDUMP=arm-cegcc-objdump
RANLIB=arm-cegcc-ranlib LIBS="-I/var/tmp/pthreads-w32-2-8-0-release
-I/opt/cegcc/include -I/opt/cegcc/arm-cegcc/include"
LDFLAGS="-L/var/tmp/pthreads-w32-2-8-0-release -L/opt/cegcc/lib
-L/opt/cegcc/arm-cegcc/lib" ./configure --host=arm-wince
--prefix=/WinCE/built --enable-shared ac_cv_func_setpgrp_void=yes
--enable-pthread=pthread

and this is my output:

axe1@axe1-desktop:/var/tmp/ruby-1.9.1-p429$ make
GNUmakefile:43: target `ruby.rc' given more than once in the same rule.
include-dir . --include-dir . --include-dir ./win32 ruby.rc ruby.res.o
make: include-dir: Command not found
make: [ruby.res.o] Error 127 (ignored)
arm-cegcc-gcc -O2 -I/var/tmp/pthreads-w32-2-8-0-release -g -Wall
-Wno-parentheses -I. -I.ext/include/arm-wince -I./include -I.
-DRUBY_EXPORT -o io.o -c io.c
io.c: In function 'rb_io_close_read':
io.c:3369: warning: implicit declaration of function 'rb_w32_is_socket'
io.c: In function 'pipe_open':
io.c:4643: warning: implicit declaration of function 'rb_w32_aspawn'
io.c:4643: error: 'P_NOWAIT' undeclared (first use in this function)
io.c:4643: error: (Each undeclared identifier is reported only once
io.c:4643: error: for each function it appears in.)
io.c:4644: warning: implicit declaration of function 'rb_w32_spawn'
io.c: In function 'io_cntl':
io.c:6709: warning: implicit declaration of function 'ioctl'
io.c: In function 'maygvl_copy_stream_wait_read':
io.c:7351: warning: implicit declaration of function 'select'
make: *** [io.o] Error 1


can anybody kick me to right way on solving this? I couldn't understand
why ruby uses some *w32* function when i'm compiling with posix
compilant toolchain...

P.S. Sorry for my bad english - my native language is russian.
 
R

Roger Pack

Maxim said:
Hi,
I'm spent countless time in searching working ruby port on Windows
Mobile. I'm not a fan of this OS, but already have device with it and
still want to try programming in ruby on it. Google kicked me to:

1. Howto compile and binaries ruby 1.8.x with Microsoft Visual Embedded
C++ ( http://uema2.s8.xrea.com/ruby-mswince/ ). This works fine, but
first of all it has Windows Mobile restriction on relative paths (ex.
requiring 'lib/some.rb" - fails) and in addition it is 1.8 - not 1.9.
There is no chance to use it as full value port, especially with
rubygems.

2. Success story of compiling ruby 1.8 with CeGCC cross compile
toolchain ( http://cegcc.sourceforge.net/ ). Here is the topic of John
Snowdon aka smed: http://www.ruby-forum.com/topic/143475 . He
successfully compiled ruby 1.8 even with rubygems (!). But for my sorry
I can't reproduce his success and his blog with binaries is down too (
http://www.target-earth.net/gadgets/code/rubyce.html ). In addition it
is 1.8 branch and it will be more likely to use 1.9.x :p

So, i'm trying to compile ruby 1.9.1 p429 with CeGCC 0.59.1 under
Ubuntu 10.04. First trouble that I get - is that confuigure script can't
verify setpgrp() while cross-compiling. I solve it by adding
"ac_cv_func_setpgrp_void=yes" to args. Next trouble was that configure
script cannot detect pthread_kill function in any header, so it suggest
not to use native threads, but in 1.9.x native threads - are mandatory.
Some search kick me to mail list with howto compile pthreads-win32 (
http://sourceware.org/ml/pthreads-win32/ ) with mingw32ce (mingw32 part
of cegcc). I reproduced his success and now i have .dll, .a and headers.
First my question is - can I it ( library compiled with mingw32ce) in
compiling with cegcc? I'm novice in cross compiling and it would be
greate if someone can hint how do I use it in compilng: some extra
environment variable, makefile edits or maybe i can add some args to
configure script? I think i choose dirty incorrect way, trying to hack
makefile and sources in order to bypass errors. I added

If it's a dll it "should" work.

io.c:3369: warning: implicit declaration of function 'rb_w32_is_socket'

I think this means that somehow compilation doesn't realize you are on
windows.
The rubyinstaller list might be helpful, as well.
http://rubyinstaller.org/

I think I remember wince being removed recently from 1.9 branch (no
maintainer, little interest), so grabbing a build *before* that might
work better. But I don't remember exactly.
 
M

Maxim Sokolovsky

Roger said:
If it's a dll it "should" work.

How do I add it in a right way? When I add it to LDFLAGS and LIBS env
variables it doesn't apear in compiling... So it runs like:
arm-cegcc-gcc -O2 -g -Wall -Wno-parentheses -I.
-I.ext/include/arm-wince -I./include -I. -DRUBY_EXPORT -o io.o -c io.c
I fix it dirty by adding "-I/path/to/pthreads" into Makefile in a line,
where -O2 parameter added.. How this could be done in right manner?

I think this means that somehow compilation doesn't realize you are on
windows.

I'm on Ubuntu linux if you mean my OS. And as far as i know configure
script should think i compile it for linux, cause cegcc emulates POSIX
API and is designed to cross-compile linux apps to windows mobile. So i
couldn't understand why it tries some *w32* functions...

The rubyinstaller list might be helpful, as well.
http://rubyinstaller.org/

I'll post my message there if I wouldn't get answers here, but... they
use MinGW32 environment to compile ruby for Win32.. This isn't near my
goal I think, isn't it?

I think I remember wince being removed recently from 1.9 branch (no
maintainer, little interest), so grabbing a build *before* that might
work better. But I don't remember exactly.

It's true. Sorry I forgot to say that I already tries to compile latest
ruby 1.9.x branch without removed WinCE scripts (it's 1.9.0.5,
http://github.com/ruby/ruby/tree/v1_9_0_5). First of all it seems that
WinCE folder there is unchanged since 1.8.x branch and it doesn't
compiles. In addition it uses Microsoft Embedded Visual C++ compiler to
build. And at http://uema2.s8.xrea.com/ruby-mswince is 1.8.x branch
compiled with official support.
 
R

Roger Pack

Maxim said:
How do I add it in a right way? When I add it to LDFLAGS and LIBS env
variables it doesn't apear in compiling... So it runs like:
arm-cegcc-gcc -O2 -g -Wall -Wno-parentheses -I.
-I.ext/include/arm-wince -I./include -I. -DRUBY_EXPORT -o io.o -c io.c
I fix it dirty by adding "-I/path/to/pthreads" into Makefile in a line,
where -O2 parameter added.. How this could be done in right manner?

is there an --enable-pthreads option? I know 1.9.2 used to try to use
pthreads on windows but then we complained so it was disallowed...
I'm on Ubuntu linux if you mean my OS. And as far as i know configure
script should think i compile it for linux, cause cegcc emulates POSIX
API and is designed to cross-compile linux apps to windows mobile. So i
couldn't understand why it tries some *w32* functions...

Something isn't detecting right, or it would never even try to build
win32.c, I imagine.
I'll post my message there if I wouldn't get answers here, but... they
use MinGW32 environment to compile ruby for Win32.. This isn't near my
goal I think, isn't it?

Yeah but they may have some expertise.
Unfortunately I don't really :)
-r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top