Skip to content

Getting 'LinkingTo' to find the right library

3 messages · Setzer.Woodrow@epamail.epa.gov, Brian Ripley

#
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
-I"C:/PROGRA~1/R/site-librar
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:
Version:
 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

Locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=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,
package:base
R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology
http://www.epa.gov/comptox
US Environmental Protection Agency
Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128    Fax: (919) 541-1194
#
Where did you get the idea that R CMD INSTALL is reading .Rprofile?
(AFAIR it does so only to find the installation library, as R CMD 
INSTALL --help says it will.)

You need to set R_LIBS in the environment to get the library path you 
want.  This is not specific to 'LinkingTo'.
On Mon, 2 Feb 2009, Setzer.Woodrow at epamail.epa.gov wrote:

            

  
    
#
(I just realized that when "they" upgraded my mail program, "they" reset
my preferences to send html and text for internet mail.  I have fixed
the preferences to text only, and apologize).
Well, where would I get the idea it was NOT reading .Rprofile, since it
clearly IS reading Rprofile.site?  However, I mainly thought that the
library being installed to would be used to find the dependent package,
because of this bug fix entry for version 2.7.2:
o The use of multiple packages in 'LinkingTo' works again, and
????????????now works when the dependent packages are in the library to
be
????????????installed to (but not in the library path seen by R
--vanilla).

Also, in this paragraph from the INSTALL help item:

     To install into the library tree 'lib', use 'R CMD INSTALL -l lib
     pkgs'.  This prepends 'lib' to 'R_LIBS' for duration of the
     install, so required packages in the installation directory will
     be found (and used in preference to those in other libraries).

Setting R_LIBS works (I DID try this before, but must have fumbled
something).

R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology
http://www.epa.gov/comptox
US Environmental Protection Agency
Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128    Fax: (919) 541-1194).

Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote on 02/02/2009 04:22:52
PM:
in
some
to
install
to
cannot
also
front
the
folder).
gcc