[Rd] Re: [R] R for ARM Linux (moved from r-help to r-devel)

Albrecht Gebhardt albrecht.gebhardt@uni-klu.ac.at
Sat, 12 May 2001 11:15:02 +0200 (MET DST)

On Fri, 11 May 2001, Cox, Terry (NEI) wrote:

> I am interested in your efforts to port R to ARM Linux.  If you are
> successful, then I have a good reason to spend the money to buy a Compaq
> iPAQ.

I have compiled R-1.2.2 for arm-linux (iPAQ) on the skiffcluster, an ARM
compile farm accessible at 


and R-1.2.3 using cross compilation tools on x86 linux (cross compilers
are also available at www.handhelds.org).

Compilation went smoothly, it is possible to start the resulting binary,
it prints its version as:
> version
platform armv4l-unknown-linux-gnu
arch     armv4l                  
os       linux-gnu               
system   armv4l, linux-gnu       
major    1                       
minor    2.2                     
year     2001                    
month    02                      
day      26                      
language R                       

but it still fails to pass the tests ("make test"):
make test (with 1.2.2) stops at
running `simple-true.R'
comparing `simple-true.Rout' to `./simple-true.Rout.save' ...33c33
< [1] FALSE
> [1] TRUE
< [1] FALSE
> [1] TRUE

The problem is, that there is no FPU in these devices (ARM processors
generally can include FPUs but not the Intel StrongARM used in those
little PDAs), so arm-linux comes with a floating point emulation
and I guess this causes the troubles. 

Of course simple things like
 > x<-c(1,2,3)
 > mean(x)
 [1] 2 
work, but even when it comes to simple plots the next problems
arise (wrong plot coordinates resulting in strange pictures).

This reminds me the problems we had with R on alpha/tru64 some time ago
(they where also generated by numeric problems, 64 versus 32 bit in this
case) and had similar results (plots didnt work and so on).

Everybody who is interested can check it at one of the skiffcluster

telnet skiffclusterX.handhelds.org (X in 1,2,3,4,5,6) 
login guest, no password.

  skiffcluster6:~$ cd agebhars@uni-klu.ac.at
  skiffcluster6:~/agebhard@uni-klu.ac.at$ ls
  R-1.2.2  R-root  minicom-1.83.1

You'll find there a source tree (R-1.2.2), and a install tree (R-root).
So try runnning "./R-root/bin/R" or do a "make test" in R-1.2.2.

The next problem with R on iPAQ will be size: With standard settings you
have only 16MB flash which holds a minimum linux distribution and leaves
you with ~3MB of free space. But we would need this already for R.bin:

  skiffcluster6:~/agebhard@uni-klu.ac.at$ ls -l R-root/lib/R/bin/R.bin
  -rwxr-xr-x    1 guest    users     3221131 Mar 31 12:53 R-root/lib/R/bin/R.bin

and the base libraries would take the next 13MB:

  skiffcluster6:~/agebhard@uni-klu.ac.at$ du -s R-root/lib/R/library/
  13372   R-root/lib/R/library

So if you want to put R on the iPAQ there will be the need for extra
memory (IBM microdrive or CF flash memory). But you will come to this
conclusion anyway, whether installing R or not, because you will also need
other things like perl, python, tcltk, ... which alltogether won't fit
into the base 16MB flash. 

But nevertheless, one task in porting for PDAs like the iPAQ will be to
reduce the basic R installation in size, cutting of unnecessary help
formats, scripts, may be even some of the datasets, and reducing the size
of the base library by moving non core functions out to libraries.

Currently I'm experimenting with the crosscompiler setup on a x86 linux
machine and R-1.2.3. I'm running R on a H3600 iPAQ 


with 16MB flash and 32MB RAM.

R resides NFS mounted across a serial ppp link on my x86 linux box, but I
will soon upgrade to additional flash memory so that I can put R directly
on the PDA.

> Terry A. Cox, MD, PhD
> National Eye Institute
> National Institutes of Health
> 31 Center Drive, MSC 2510
> Building 31, Room 6A52
> Bethesda, MD 20892-2510
> Phone: 301-496-6583
> FAX: 301-496-2297
> Email: tac@nei.nih.gov
> -----Original Message-----
> From: Kurt Hornik [mailto:Kurt.Hornik@ci.tuwien.ac.at]
> Sent: Friday, May 11, 2001 3:27 PM
> To: Cox, Terry (NEI)
> Cc: 'r-help@lists.R-project.org'
> Subject: Re: [R] R for ARM Linux
> >>>>> Cox, Terry (NEI) writes:
> > Would it be possible to port R to ARM Linux for Compaq iPaq and similar
> > handheld computers?  (See http://handhelds.org/).
> I think Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at> has mostly
> get this to work.

still some work to do, see above ;)

> -k


// Albrecht Gebhardt          Tel.: (++43 463) 2700/3118
// Institut fuer Mathematik   Fax : (++43 463) 2700/3198
// Universitaet Klagenfurt    mailto:albrecht.gebhardt@uni-klu.ac.at
// Universitaetsstr. 65       http://www-stat.uni-klu.ac.at/~agebhard
// A-9020 Klagenfurt, Austria 

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch