[Rd] Makefile for embedding OpenBUGS in R package

Tobias Verbeke tobias.verbeke at telenet.be
Mon Aug 6 13:09:28 CEST 2007

   Dear list, 

   I'm trying to embed OpenBUGS in an R package for use of it
   on 64-bit Linux. In order to get the CLI working one has to
   compile C code contained in $OpenBUGS/Manuals/CBugs.html
   (copied to say CBugs.c) using
   gcc -m32 -o bugs CBugs.c -ldl

   I put the OpenBUGS distribution in the ./inst subdirectory of
   the package root. Where should I now put the CBugs.c and how
   should the Makefile look like in order to be able to call
   $PKG_ROOT/OpenBUGS/bugs afterwards ?

   Naively putting the following Makefile in ./src does not work

   bugs: ../inst/OpenBUGS/CBugs.c
        gcc -m32 -o bugs ../inst/OpenBUGS/CBugs.c -ldl

   The objective is to use something along the following 

   execfile <- system.file("OpenBUGS", "bugs", package = mypkg)
   system(paste(execfile, "< somescript.script > somefile.out"))

   This system call to the CLI is currently the only (non-WINE) 
   way of using OpenBUGS on Linux in batch mode.    

   Many thanks in advance,


Tobias Verbeke - Consultant
Business & Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
tobias.verbeke at businessdecision.com

More information about the R-devel mailing list