1

I am trying to build and check a package with some Fortran code in it under Windows 10 with R 3.4.0 updating some code previously in R 2.8. I am doing this in three steps in the command window:

>R CMD build src
[...]
* checking DESCRIPTION meta-information ... OK

So I assume everything is ok with the DESCRIPTION file then:

>R CMD check --no-examples --no-tests src

I get among other stuff:

* checking for file 'src/DESCRIPTION' ... OK

A bit further it gets wrong at

* checking whether package 'pckgname' can be installed 

Looking at the log inside the file /src.Rcheck/00install.out, I read:

Error in .get_package_metadata(dir, FALSE) : 
Files 'DESCRIPTION' and 'DESCRIPTION.in' are missing.
ERROR: installing Rd objects failed for package 'samara'

I have copied and pasted the DESCRIPTION file pretty much everywhere it made sense, including the top level directory and the \src directory or in those directory alone in some other trials, with always the same result. This is strange because sometimes the DESCRIPTION file is recognized, sometimes it is not

There is only one similar post treating this subject: R package building error the author seems to have solved his problem but he doesn't know how. Does anybody know what happened?

Following some requests, here is the content of the files 00check.log and 00install.out:

00check.log

C:\Users\username\Documents\PCKGNAME\SRC_5.0.2E\pckgname>R CMD check --no-  examples --no-tests src

* using log directory 'C:/Users/username/Documents/PCKGNAME/SRC_5.0.2E/pckgname/src.Rcheck'
* using R version 3.4.0 (2017-04-21)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using options '--no-examples --no-tests'
* checking for file 'src/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'pckgname' version '5.0.2.5'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... NOTE
Found the following apparent object files/libraries:
src-x64/FortPrg1.o src-x64/FortPrg2.o src-x64/FortPrg3.o
Object files/libraries should not be included in a source package.
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
R/.Rhistory
These were most likely included in error. See section 'Package
structure' in the 'Writing R Extensions' manual.
* checking for portable file names ... OK
* checking whether package 'pckgname' can be installed ... ERROR
Installation failed.
See 'C:/Users/username/Documents/PCKGNAME/SRC_5.0.2E/pckgname/src.Rcheck/00install.out' for details.
* DONE
Status: 1 ERROR, 2 NOTEs

In Prompt, there is this information in addition to what appeared before:

* checking whether package 'pckgname' can be installed ...
Warning: l'exécution de la commande '"C:/PROGRA~1/R/R-34~1.0/bin/x64/Rcmd.exe" 
INSTALL -l "C:/Users/username/Documents/PCKGNAME/SRC_5.0.2E/pckgname/src.Rcheck" --no-html 
"C:\Users\username\DOCUME~1\PCKGNAME\SRC_30~1.7E\pckgname\src"' renvoie un statut 1

Now in the file 00install.out:

* installing *source* package 'pckgname' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/gfortran    -O3  -mtune=core2 -c  FortPrg1.f90 -o FortPrg1.o
c:/Rtools/mingw_32/bin/gfortran    -O3  -mtune=core2 -c  FortPrg2.f90 -o FortPrg2.o
c:/Rtools/mingw_32/bin/gfortran    -O3  -mtune=core2 -c  FortPrg3.f90 -o FortPrg3.o
c:/Rtools/mingw_32/bin/gfortran -shared -s -static-libgcc -o pckgname.dll   tmp.def FortPrg1.o FortPrg2.o FortPrg3.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-34~1.0/bin/i386 -lR
installing to C:/Users/username/Documents/PCKGNAME/SRC_5.0.2E/pckgname/src.Rcheck/pckgname/libs/i386

*** arch - x64
c:/Rtools/mingw_64/bin/gfortran    -O2  -mtune=core2 -c  FortPrg1.f90 -o FortPrg1.o
c:/Rtools/mingw_64/bin/gfortran    -O2  -mtune=core2 -c  FortPrg2.f90 -o FortPrg2.o
c:/Rtools/mingw_64/bin/gfortran    -O2  -mtune=core2 -c  FortPrg3.f90 -o FortPrg3.o
c:/Rtools/mingw_64/bin/gfortran -shared -s -static-libgcc -o pckgname.dll tmp.def FortPrg1.o FortPrg2.o FortPrg3.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-34~1.0/bin/x64 -lR
installing to C:/Users/username/Documents/PCKGNAME/SRC_5.0.2E/pckgname/src.Rcheck/pckgname/libs/x64
** R
** demo
** preparing package for lazy loading
Warning: package 'survival' was built under R version 3.4.4
Warning: package 'boot' was built under R version 3.4.4
Warning: package 'xlsx' was built under R version 3.4.4
Warning: package 'ggplot2' was built under R version 3.4.4
Warning: package 'GGally' was built under R version 3.4.4
[1] "Chargement de gdata ..."
[1] "Chargement de survival ..."
[1] "Chargement de boot ..."
[1] "Chargement de tcltk ..."
[1] "Chargement de xlsx ..."


---------------------------------------------
Package PCKGNAME genere le ven. sept. 28 17:14:21 2018 
---------------------------------------------


Librairie Pckgname V5.0.2E Chargee
** help
No man pages found in package  'pckgname' 
Error in .get_package_metadata(dir, FALSE) : 
Files 'DESCRIPTION' and 'DESCRIPTION.in' are missing.
ERROR: installing Rd objects failed for package 'pckgname'
* removing 'C:/Users/username/Documents/PCKGNAME/SRC_5.0.2E/pckgname/src.Rcheck/pckgname'
Matt Dnv
  • 1,620
  • 13
  • 23
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Right now we have no idea how your code and files are structured in your package. – MrFlick Sep 27 '18 at 16:19
  • Just noticed this: "I have copied and pasted the DESCRIPTION file pretty much everywhere it made sense." It only makes sense to have it in *one* place: in the top level directory of the package. You *really* need to follow @MrFlick's advice and tell us the details of what you did. – user2554330 Sep 28 '18 at 13:41
  • I have made several trials, starting with one when there is only one DESCRIPTION file and where it is at the top directory – Matt Dnv Sep 28 '18 at 21:03

2 Answers2

0

Usually you would store a package named samara in a directory of the same name. You appear to have it in src. That should work, but I wouldn't be surprised if something in the check code implicitly assumes you were following the usual convention.

The other thing that is usually done is that you create a source tarball of the package and check that. That is, you run R CMD check on the output of R CMD build, not on the input. Again, what you are doing should mostly work (though not perfectly in this case; tarball contents typically are not identical to source directories), but perhaps these two nonstandard ways of working are causing your problems.

user2554330
  • 37,248
  • 4
  • 43
  • 90
  • Hi usr. Thanks a lot. The package in tar.gz is stored in the directory of the same name. Also doing R CMD check before R CMD build leads to the same error. I have tried under R Studio putting changing the src/src/ and src/R directories into the package directory with the fortran code into src and the r code into R. Still the same problem – Matt Dnv Sep 28 '18 at 13:15
  • It is not at all clear from your comment what you have done now. You should edit the original question to give the actual commands that you tried. – user2554330 Sep 28 '18 at 13:24
  • I have added some more code dear user2554330. I hope it helps – Matt Dnv Sep 28 '18 at 16:21
  • It looks as though you didn't follow my suggestion. You should rename the top level `src` directory to `pckgname` (or `samara`, or whatever the package name is). You should also run your checks on the tarball, not on the source directory. – user2554330 Sep 28 '18 at 16:55
  • Dear user2554330, I have tried so far the following configurations: 1- pckgname/src/R (R code) and pckgname/src/src (fortran code) 2- pckgname/R (R code) and pckgname/src (fortran code) with the same bug I am showing you in the configuration 1 on the main post. Next week, when I have access to the files again, I can show you configuration 2. My next investigation step will be to modify the R3.4.0 source code in order to see what is the dir that is inside .get_package_metadata(dir,false). – Matt Dnv Sep 28 '18 at 20:49
  • Why would you put R code in pckgname/src/R? Who ever suggested that to you? You should follow the directory structure in the documentation, not make things up on your own. – user2554330 Sep 28 '18 at 20:52
  • This is the existing code I started with. I guess the author who's not me did that for a reason. At the time it was R 2.4. But I also have made another form of organization (at least I think so) according to your recommendations, the similar result of which I can show you next week. – Matt Dnv Sep 28 '18 at 20:57
  • Dear user2554330: thanks to your advice, I solved the problem. I did the following things: -I reorganized into pckgname/R and pckname/src -I used R Studio and put everything into a R project, the skeleton of the project being with R>create new package>create new package with Devtools -I built and checked exclusively with the Rstudio interface – Matt Dnv Oct 03 '18 at 12:22
0

With the help of user2554330, I solved the problem. I did the following things:

-I reorganized into pckgname/R and pckgname/src (instead of pckgname/src/R and pckgname/src/src previously )

-I used R Studio. First I created a new project (create a new package) with RStudio and devtools: File>Create new project>R Package using devtools. And I put my files there

-I built and checked exclusively with the Rstudio interface

Matt Dnv
  • 1,620
  • 13
  • 23