[Rd] Makefile for embedding OpenBUGS in R package
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Aug 6 15:46:34 CEST 2007
On Mon, 6 Aug 2007, Tobias Verbeke wrote:
> 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
same as
http://mathstat.helsinki.fi/openbugs/data/Docu/CBugs.html
I presume.
> (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
Why do you want to install CBugs.c?
> 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
What does 'does not work' mean? It's hard to know whether this is just
not doing what you wanted, or something else is wrong.
> -%--------
> 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.
I think you need to make ../inst/OpenBUGS/bugs, not src/bugs. So
something like
all: ../inst/OpenBUGS/bugs
../inst/OpenBUGS/bugs: ../inst/OpenBUGS/CBugs.c
gcc -m32 -o ../inst/OpenBUGS/bugs ../inst/OpenBUGS/CBugs.c -ldl
However, -m32 builds a 32-bit executable on 64-bit linux. Is that what you
wanted?
--
Brian D. Ripley, ripley at 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, UK Fax: +44 1865 272595
More information about the R-devel
mailing list