[Rd] Getting 'LinkingTo' to find the right library

Setzer.Woodrow at epamail.epa.gov Setzer.Woodrow at epamail.epa.gov
Mon Feb 2 21:39:21 CET 2009

I am experimenting with exporting pointers to some of the functions in
deSolve so that other packages may import them, using the
'R_RegisterCCallable' mechanism.  I have added a header file and some
other C code in inst/include of the deSolve source package that need to
be accessible to other packages.  I have a site-library set up in
Rprofile.site where all installed packages go, and as long as my
experimental version of deSolve is installed there,  I'd like to install
my modified copy of deSolve in a test library.  However, when I try to
install my test package (which includes both Depends: deSolve and
LinkingTo: deSolve, in its Description file, as described in 'R
Extensions'), compilation fails, because the appropriate C code cannot
be found (there is also an unrelated problem in deSolve_stubs.c
triggering the "unexpected ')' before '*' token" error).

[test]$ R CMD INSTALL -l C:/home/Rlib-test dma

---------- Making package dma ------------
  adding build stamp to DESCRIPTION
  installing NAMESPACE file and metadata
  making DLL ...
gcc  -std=gnu99  -Ic:/PROGRA~1/R/R-28~1.1PA/include
y/deSolve/include"    -O3 -Wall  -c R_init_dma.c -o R_init_dma.o
R_init_dma.c:1:27: error: deSolve_stubs.c: No such file or directory
R_init_dma.c:3: error: expected ')' before '*' token
make[3]: *** [R_init_dma.o] Error 1
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2
make: *** [pkg-dma] Error 2
*** Installation of dma failed ***

Removing 'C:/home/Rlib-test/dma'

It seems that although the 'site-library/deSolve/include' folder is
included in the search list for included files, the
'Rlib-test/deSolve/include' folder is not.  The folder that includes
both the experimental version of deSolve and the test package dma also
contains a .Rprofile file which places 'C:/home/Rlib-test' at the front
of the library search path, and I have confirmed that this is so (in
fact, the above INSTALL command does not need the '-l ' argument; the
default install location is Rlib-test for installs from this folder).
It looks as if the code in INSTALL that sets up the -I arguments to gcc
does not find the library path defined for this folder.  Can someone
point me to the right way to do this?

System information:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 8.1
 year = 2009
 month = 01
 day = 04
 svn rev = 47474
 language = R
 version.string = R version 2.8.1 Patched (2009-01-04 r47474)

Windows XP (build 2600) Service Pack 2

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, package:grDevices,
package:utils, package:datasets, package:methods, Autoloads,
R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology
US Environmental Protection Agency
Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128    Fax: (919) 541-1194

More information about the R-devel mailing list