Setzer.Woodrow at epamail.epa.gov
2009-Feb-02 20:39 UTC
[Rd] Getting 'LinkingTo' to find the right library
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
Prof Brian Ripley
2009-Feb-02 21:22 UTC
[Rd] Getting 'LinkingTo' to find the right library
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 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 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- 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