[R] glitch in building R package

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Jan 24 09:46:17 CET 2011



On 22.01.2011 00:16, Horace Tso wrote:
> I follow Alan Lenarcic's very helpful tutorial on building R package for Windows (XP), which could be found in www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf<http://www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf>. The package involves a small dll compiled from some very simple C++ codes.

1. Although the tutorial was certainly very helpful at the time it was 
written, some parts are outdated these days. Please read Writing R 
Extensions and the R Installation and Administration manual.

2. You probably forgot to tell your package to do something that 
corresponds to dyn.load, either in a .FirstLib or in a NAMESPACE directive.

Best,
Uwe Ligges





>
> The build process seemed to work smoothly, until i install. Then I got an error saying the C function was not in the load table. This is rather mysterious because I've been able to call this function from R with dyn.load("name.dll"). So the dll is working.
>
> The install error says :
>
> C:\R-test>R CMD INSTALL --build FirstPack_0.1.tar.gz
> * installing to library 'c:/R/R-2.12.0/library'
> * installing *source* package 'FirstPack' ...
> ** libs
> cygwin warning:
>    MS-DOS style path detected: c:/R/R-2.12.0/etc/i386/Makeconf
>    Preferred POSIX equivalent is: /cygdrive/c/R/R-2.12.0/etc/i386/Makeconf
>    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
>    Consult the user's guide for more details about POSIX paths:
>      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
> g++ -I"c:/R/R-2.12.0/include"         -O2 -Wall  -c XDemo.cpp -o XDemo.o
> g++ -I"c:/R/R-2.12.0/include"         -O2 -Wall  -c XDemo_main.cpp -o XDemo_main
> .o
> g++ -shared -s -static-libgcc -o FirstPack.dll tmp.def XDemo.o XDemo_main.o -Lc:
> /R/R-2.12.0/bin/i386 -lR
> installing to c:/R/R-2.12.0/library/FirstPack/libs/i386
> ** R
> ** data
> Warning: empty 'data' directory
> ** preparing package for lazy loading
> Error in .C("DemoAutoCor", OutVec = as.double(vector("numeric", OutLength)),  :
>
>    C symbol name "DemoAutoCor" not in load table
> ERROR: lazy loading failed for package 'FirstPack'
> * removing 'c:/R/R-2.12.0/library/FirstPack'
> Here is how i built the package. I have the directory structure as described in "Writing R Extensions" and I issued the following command in DOS prompt,
>
> C:\R-test>R CMD build FirstPack
> * checking for file 'FirstPack/DESCRIPTION' ... OK
> * preparing 'FirstPack':
> * checking DESCRIPTION meta-information ... OK
> * cleaning src
> cygwin warning:
>    MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
>    Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
>    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
>    Consult the user's guide for more details about POSIX paths:
>      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
> cygwin warning:
>    MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
>    Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
>    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
>    Consult the user's guide for more details about POSIX paths:
>      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
> Warning in readLines(ldpath) :
>    incomplete final line found on 'FirstPack/DESCRIPTION'
> * checking for LF line-endings in source and make files
> * checking for empty or unneeded directories
> WARNING: directory 'FirstPack/data' is empty
> * building 'FirstPack_0.1.tar.gz'
> cygwin warning:
>    MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
>    Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
>    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
>    Consult the user's guide for more details about POSIX paths:
>      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
> cygwin warning:
>    MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
>    Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
>    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
>    Consult the user's guide for more details about POSIX paths:
>      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
>
> Thanks in advance.
>
> H
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list