Skip to content

Checking and building package

3 messages · Uwe Ligges, Petar Milin

#
Hello!
I am truing to compile an R-package having c-code. I put foo.c in src/ 
folder and useDynLib("foo") in NAMESPACE file. When trying R CMD check, 
I got an error message that shared object 'foo' is not found. Then I did 
R CMD SHLIB foo.c first. However, after that, I got warnings from R CMD 
check that there is an object file in /src folder. Even worse is if I 
run R CMD SHLIB for Windows and for Linux and put in /src both foo.so 
and foo.dll.
What I am doing wrong? I thought that only *.c is needed in src/, then, 
I read in someones advice that both the source and shared library must 
be in src/. What should be done if one wants to prepare for CRAN?

Thanks!

Best,
Petar
#
On 03.06.2011 21:46, Petar Milin wrote:
Where "foo" is the name of your package, I hope.
Does R CMD INSTALL yourpackage generate a packagename.so (or .dll)? If 
so, it is just the useSynLib() entry that fails. Or does R CMD INSTALL 
give any error message?

Uwe Ligges


 > in NAMESPACE file. When trying R CMD check,
#
Hello Uwe,
No, "foo" is the name of C-file -- "foo.c". Package has different name.
I tried R CMD INSTALL myPackage. And, yes there is a myPackage.so in 
src/ folder, but not "foo.so". I got an error message that says:
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in library.dynam(lib, package, package.lib) :
shared object 'foo' not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ?/usr/local/lib/R/site-library/myPackage?
* restoring previous ?/usr/local/lib/R/site-library/myPackage?

Thanks!
Petar
On 03/06/11 22:32, Uwe Ligges wrote: