[Rd] Unable to install rggobi in R 2.15

2012-04-28 Thread Indrajit Sengupta
I am currently using R 2.15.0 with R Tools 2.15 (in Windows XP). I downloaded 
the source for RGgobi and extracted it to a folder.
 
Then I tried compiling and installing with the following command and got an 
error message:

D:\Work\tmp>R CMD INSTALL --build "D:\\DPF\\Rggobi\\rggobi"
* installing to library 'C:/Program Files/R/R-2.15.0/library'
* installing *source* package 'rggobi' ...
** libs
cygwin warning:
  MS-DOS style path detected: C:/PROGRA~1/R/R-215~1.0/etc/i386/Makeconf
  Preferred POSIX equivalent is: 
/cygdrive/c/PROGRA~1/R/R-215~1.0/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc  -I"C:/PROGRA~1/R/R-215~1.0/include" -DNDEBUG -D_R_=1 -DUSE_R=1 
-mms-bitfields -I/include/gtk-2.0 -I/include/gdk-pixbuf-2.0 
-I/../lib/gtk-2.0/include -
I/include/atk-1.0 -I/include/cairo -I/include/pango-1.0 -I/include/glib-2.0 
-I/../lib/glib-2.0/include -I/include/libxml2 -I/include -I/include/ggobi -IC:/
PROGRA~1/R/R-215~1.0/include -I/include/libxml -O3 -Wall  -std=gnu99 
-mtune=core2 -c RSEval.c -o RSEval.o
In file included from RSEval.c:6:0:
RSGGobi.h:5:22: fatal error: GGobiAPI.h: No such file or directory
compilation terminated.
make: *** [RSEval.o] Error 1
ERROR: compilation failed for package 'rggobi'
* removing 'C:/Program Files/R/R-2.15.0/library/rggobi'

 
Can anybody help in figuring out what is the problem? I have installed GGobi & 
RGtk2 previously.

Regards,
Indrajit
[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Creating a package which contains stand-alone C code

2012-04-28 Thread Rajen Shah
I would like to create an R package which uses some C code, which in
turn uses MPI. At the moment I'm only interested in creating this
package for UNIX-like systems. The way I envisage this working is for
the R package to contain an R function which uses the system call to
run the C code as a separate process (passing to the C code the
location of a file of data). The C code can then do what it needs to
do with the data, send its output to a file, and when it has finished
R can read the output from the file.

My question is, is it possible to create an R package which contains C
code which can then be called by an R function in that package using
the system call? The obstacles seem to be (i) compiling this C code in
the right way for it to be called by system, and (ii) giving the R
function responsible for calling the C code (via system) the location
of the executable.

>From my understanding of the R extensions manual (i) can be solved
using careful configure script and Makevars file (though I don't know
the details), and (ii) would require me to provide an R script
`src/install.libs.R’, which would need to copy the executable to the
right place, and modify my R function which uses the system call so it
knows where to look for the executable.

The reason I’m interested in calling the C code in this peculiar way,
rather than using the .C interface, for example, is that I’m worried
about using MPI from within R. At least, my knowledge of both R and
MPI is insufficient to be confident that calling MPI from within R
will run smoothly. Also, this way I can debug the C program entirely
on its own.

I realise there is an R package, Rmpi, which provides a wrapper for
most of the MPI functions, but since all my code will be in C, it
seems less sensible to make use of this, though I may be wrong.

Thank you for taking to the time to read this, and I very much
appreciate any advice, (especially) even if it is to say that my
proposed approach is entirely daft and I should do things completely
differently. Also, if you know of any examples of packages which do
what I’ve described above, I’d be very glad to know (it seems Sjava
does something like this?).

Best wishes,

Rajen Shah

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Creating a package which contains stand-alone C code

2012-04-28 Thread Simon Urbanek
On Apr 27, 2012, at 9:54 AM, Rajen Shah wrote:

> I would like to create an R package which uses some C code, which in
> turn uses MPI. At the moment I'm only interested in creating this
> package for UNIX-like systems. The way I envisage this working is for
> the R package to contain an R function which uses the system call to
> run the C code as a separate process (passing to the C code the
> location of a file of data). The C code can then do what it needs to
> do with the data, send its output to a file, and when it has finished
> R can read the output from the file.
> 
> My question is, is it possible to create an R package which contains C
> code which can then be called by an R function in that package using
> the system call? The obstacles seem to be (i) compiling this C code in
> the right way for it to be called by system, and (ii) giving the R
> function responsible for calling the C code (via system) the location
> of the executable.
> 
>> From my understanding of the R extensions manual (i) can be solved
> using careful configure script and Makevars file (though I don't know
> the details),

Simply add a target for your executable to Makevars.


> and (ii) would require me to provide an R script
> `src/install.libs.R’, which would need to copy the executable to the
> right place, and modify my R function which uses the system call so it
> knows where to look for the executable.
> 

Yes, you can have a look at Rserve (preferably the development version) for 
both of the above. It is not the perfect example (because it grew organically 
and is a bit more complex) but it does exactly that.


> The reason I’m interested in calling the C code in this peculiar way,
> rather than using the .C interface, for example, is that I’m worried
> about using MPI from within R. At least, my knowledge of both R and
> MPI is insufficient to be confident that calling MPI from within R
> will run smoothly. Also, this way I can debug the C program entirely
> on its own.
> 

Conceptually, you can achieve the same thing without another executable by 
forking and calling the main() function of your program -- that way you don't 
need another executable yet you can compile your code either as a stand-alone 
program (for testing) or as a package (for deployment):

SEXP call_main(SEXP args) {
   int argc = LENGTH(args), i;
   pid_t pid;
   char **argv = (char**) calloc(argc + 1, sizeof(char*));
   for (i = 0; i < argc; i++) argv[i] = CHAR(STRING_ELT(args, i));
   if ((pid = fork()) == 0) { main(argc, argv); exit(0); }
   return ScalarInteger(pid);
}

and PKG_CPPFLAGS=-Dmain=prog_main make sure you re-map main for the package in 
case it conflicts with R.

In general, you can do better and pass your data directly -- just define some 
interface in your program -- it will be much more efficient than going through 
files. Then your main() for the stand-alone program will read in the files and 
call that interface whereas R will call it directly.

Cheers,
Simon


> I realise there is an R package, Rmpi, which provides a wrapper for
> most of the MPI functions, but since all my code will be in C, it
> seems less sensible to make use of this, though I may be wrong.
> 
> Thank you for taking to the time to read this, and I very much
> appreciate any advice, (especially) even if it is to say that my
> proposed approach is entirely daft and I should do things completely
> differently. Also, if you know of any examples of packages which do
> what I’ve described above, I’d be very glad to know (it seems Sjava
> does something like this?).
> 
> Best wishes,
> 
> Rajen Shah
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Unable to install rggobi in R 2.15

2012-04-28 Thread Prof Brian Ripley

Do not cross-post.  This was answered on R-help.


On 28/04/2012 02:47, Indrajit Sengupta wrote:

I am currently using R 2.15.0 with R Tools 2.15 (in Windows XP). I downloaded 
the source for RGgobi and extracted it to a folder.

Then I tried compiling and installing with the following command and got an 
error message:

D:\Work\tmp>R CMD INSTALL --build "D:\\DPF\\Rggobi\\rggobi"
* installing to library 'C:/Program Files/R/R-2.15.0/library'
* installing *source* package 'rggobi' ...
** libs
cygwin warning:
   MS-DOS style path detected: C:/PROGRA~1/R/R-215~1.0/etc/i386/Makeconf
   Preferred POSIX equivalent is: 
/cygdrive/c/PROGRA~1/R/R-215~1.0/etc/i386/Makeconf
   CYGWIN environment variable option "nodosfilewarning" turns off this warning.
   Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc  -I"C:/PROGRA~1/R/R-215~1.0/include" -DNDEBUG -D_R_=1 -DUSE_R=1 
-mms-bitfields -I/include/gtk-2.0 -I/include/gdk-pixbuf-2.0 -I/../lib/gtk-2.0/include -
I/include/atk-1.0 -I/include/cairo -I/include/pango-1.0 -I/include/glib-2.0 
-I/../lib/glib-2.0/include -I/include/libxml2 -I/include -I/include/ggobi -IC:/
PROGRA~1/R/R-215~1.0/include -I/include/libxml -O3 -Wall  -std=gnu99 
-mtune=core2 -c RSEval.c -o RSEval.o
In file included from RSEval.c:6:0:
RSGGobi.h:5:22: fatal error: GGobiAPI.h: No such file or directory
compilation terminated.
make: *** [RSEval.o] Error 1
ERROR: compilation failed for package 'rggobi'
* removing 'C:/Program Files/R/R-2.15.0/library/rggobi'


Can anybody help in figuring out what is the problem? I have installed GGobi&  
RGtk2 previously.

Regards,
Indrajit
[[alternative HTML version deleted]]




__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel