[Rd] R CMD check, NAMESPACE, import: bad error?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jan 22 10:35:18 CET 2006


On Sun, 22 Jan 2006, Berwin A Turlach wrote:

> G'day Brian,
>
>>>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
>
>    BDR> We do recommend you try INSTALLing and loading the package
>    BDR> before R CMD check.
> I have to rely on my memory, but if I remember correctly, installing
> and loading the package worked.  It was only when it came to "R CMD
> check" that the combination of having a NAMESPACE and no "PACKAGE="
> argument in a .Fortran() call made "R CMD check" complain.  (With much
> the same complaints that Seth reported).

I perhaps should have said that loading the R_DEFAULT_PACKAGES=NULL is 
sometimes also useful.

> But now I am utterly confused because I wanted to test if my memory is
> correct.  So I went back to the package (called SCSS) with which I
> experienced these problems (according to the dates of the files I was
> putting that package together around 12 October 2005, which was just
> after the release of R 2.2.0 and I believe I was using that version).
>
> After removing the "PACKAGE=" arguments from the .Fortran() calls, the
> package installs and loads fine.  But to my utter amazement, "R CMD
> check" now works without a problem.  I tried this command with R
> 2.1.1, R 2.2.0, R 2.2.1 and R 2.3.0 (i.e. R-devel).
>
> What surprised me most, was that all these versions said
>
> * checking foreign function calls ... OK
>
> I thought that this check is supposed to catch missing "PACKAGE="
> arguments in .C(), .Fortran() &c calls???

Not quite: `needed and missing'.  If R is able to work out the 
package from the NAMESPACE info, it is not reported.  That changed in 
2.2.0:

     o	checkFF() used by R CMD check has since R 2.0.0 not reported
 	missing PACKAGE arguments when testing installed packages with
 	namespaces.  It now

 	- treats installed and source packages in the same way.

 	- reports missing arguments unless they are in a function in
 	  the namespace with a useDynLib declaration (as the
 	  appropriate DLL for such calls can be searched for).

There is a further change in pre-2.3.0.


> The only explanation I have, is that my Debian linux system was some
> time ago upgraded to gcc 4.0.3 and gfortran.  Indeed, running "R CMD
> check" with R 2.3.0 produces a 00install.out file in the SCSS.Rcheck
> directory that says:
>
> * Installing *source* package 'SCSS' ...
> ** libs
> make[2]: Entering directory `/home/berwin/lang/R/Develop/SCSS/src'
> gfortran   -fpic  -g -O2 -c evsp.f -o evsp.o
> gfortran   -fpic  -g -O2 -c evsp1d.f -o evsp1d.o
> gfortran   -fpic  -g -O2 -c repar.f -o repar.o
> gcc -shared -L/usr/local/lib -o SCSS.so evsp.o evsp1d.o repar.o  -lgfortran -lm -lgcc_s
>
> whereas R 2.1.1, R 2.2.0 and R 2.2.1 issue the following lines during
> "R CMD check":
>
> * Installing *source* package 'SCSS' ...
> ** libs
> make[2]: Entering directory `/home/berwin/lang/R/Develop/SCSS/src'
> g77   -fPIC  -g -O2 -c evsp.f -o evsp.o
> g77   -fPIC  -g -O2 -c evsp1d.f -o evsp1d.o
> g77   -fPIC  -g -O2 -c repar.f -o repar.o
> gcc -shared -L/usr/local/lib -o SCSS.so evsp.o evsp1d.o repar.o  -L/usr/lib/gcc/i486-linux-gnu/3.4.5 -lg2c -lm -lgcc_s
>
> since those versions of R where compiled and installed while I was
> using gcc 3.4 on my machine.
>
> But on my machine I have now:
>
> [bossiaea:Develop]$ file `which gcc`
> /usr/bin/gcc: symbolic link to `gcc-4.0'
>
> I redirected the link to point to gcc-3.4, but I still could not
> reproduce the problems that I experienced last October (and which Seth
> experienced right now).  Perhaps the problem only occurs with a very
> specific version of the gcc compiler??
>
>    >> [...]  My advise would be to check all .C() and .Fortran()
>    >> calls in your package and add the "package=" argument if it is
>    >> missing.
>    BDR> (It had better be PACKAGE= !)
> Of course, my bad.
>
> Cheers,
>
>        Berwin
>
> ______________________________________________
> 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



More information about the R-devel mailing list