Difference between R CMD INSTALL and devtools::install

Hi,
I'm having trouble with a package installation
I need to modify a .h file in the SRC folder of this package, following package author recommendation.

Then in the Terminal I do:

R CMD INSTALL rmetasim-master

Link of the modified package, to reproduce...

there are some warnings, but the package do install and works.

Now, when I'm trying to do this within devtools, the function throws an error with the end result that the package is not installed.

Question 1: I'm i doing something wrong?
Question 2: Is there an argument I haven't seen to turn off warnings in devtools::install

Best,
Thierry

Can you show this here?

  1. Using in the Terminal: R CMD INSTALL rmetasim-master
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘rmetasim’ ...
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'default/America/Montreal'
** libs
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c AlleleObj.cc -o AlleleObj.o
AlleleObj.cc: In member function ‘void SeqAllele::RandomSeq(double, double, double, double)’:
AlleleObj.cc:98:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       while (i<sl)
              ~^~~
AlleleObj.cc: In member function ‘void SeqAllele::mutate()’:
AlleleObj.cc:174:30: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   b = RandLibObj.unirange(sl - 1);
                           ~~~^~~
AlleleObj.cc: In member function ‘bool SeqAllele::Compare(SeqAllele)’:
AlleleObj.cc:200:19: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      if (GetSite(i) != obj.GetSite(i))
                   ^
AlleleObj.cc:200:37: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      if (GetSite(i) != obj.GetSite(i))
                                     ^
AlleleObj.cc: In member function ‘virtual void SeqAllele::WriteState(std::ostream&)’:
AlleleObj.cc:215:22: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       sob = GetSite(i);
                      ^
AlleleObj.cc: In member function ‘virtual void SeqAllele::Write(std::ostream&)’:
AlleleObj.cc:227:22: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       sob = GetSite(i);
                      ^
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c AlleleTbl.cc -o AlleleTbl.o
AlleleTbl.cc: In member function ‘void AlleleLookTbl::clear()’:
AlleleTbl.cc:35:13: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   asz = size();
         ~~~~^~
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c BaseObj.cc -o BaseObj.o
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c Democlass.cc -o Democlass.o
Democlass.cc: In member function ‘void DemoClass::CompressClass(double)’:
Democlass.cc:127:26: warning: conversion to ‘double’ from ‘std::map<int, PackedIndividual, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   if (I.size()>0&&(I.size()<maxind*frac))
                    ~~~~~~^~
Democlass.cc:142:7: warning: conversion to ‘std::map<int, PackedIndividual, std::less<int> >::key_type {aka int}’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    I[i]=tvec[i];
       ^
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c FastAllele.cc -o FastAllele.o
FastAllele.cc: In member function ‘virtual int InfAlleleTbl::getRandAlleleIndex()’:
FastAllele.cc:80:14: warning: conversion to ‘int’ from ‘std::map<int, Allele, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz = A.size();
        ~~~~~~^~
FastAllele.cc: In member function ‘virtual void InfAlleleTbl::CalcProps()’:
FastAllele.cc:144:12: warning: conversion to ‘int’ from ‘std::map<int, Allele, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz=A.size();
      ~~~~~~^~
FastAllele.cc: In member function ‘virtual void InfAlleleTbl::Write(std::ostream&)’:
FastAllele.cc:419:12: warning: conversion to ‘int’ from ‘std::map<int, Allele, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz=A.size();
      ~~~~~~^~
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c FastSeqAllele.cc -o FastSeqAllele.o
FastSeqAllele.cc: In member function ‘virtual int SeqAlleleTbl::getRandAlleleIndex()’:
FastSeqAllele.cc:44:14: warning: conversion to ‘int’ from ‘std::map<int, SeqAllele, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz = A.size();
        ~~~~~~^~
FastSeqAllele.cc: In member function ‘virtual void SeqAlleleTbl::CalcProps()’:
FastSeqAllele.cc:107:12: warning: conversion to ‘int’ from ‘std::map<int, SeqAllele, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz=A.size();
      ~~~~~~^~
FastSeqAllele.cc: In member function ‘int SeqAlleleTbl::addAlleleState(SequenceType, int)’:
FastSeqAllele.cc:239:23: warning: conversion to ‘int’ from ‘std::vector<char>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   SeqAllele a(seq.size());
               ~~~~~~~~^~
FastSeqAllele.cc: In member function ‘virtual void SeqAlleleTbl::Write(std::ostream&)’:
FastSeqAllele.cc:350:12: warning: conversion to ‘int’ from ‘std::map<int, SeqAllele, std::less<int> >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz=A.size();
      ~~~~~~^~
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c Genotype.cc -o Genotype.o
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c Landscape.cc -o Landscape.o
Landscape.cc: In member function ‘void Landscape::popsizeset(std::vector<int>&)’:
Landscape.cc:607:14: warning: conversion to ‘int’ from ‘std::vector<int>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   psz=ps.size();
       ~~~~~~~^~
Landscape.cc: In member function ‘int Landscape::PopSize(int)’:
Landscape.cc:667:18: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
        tot = tot + I[i].size();
              ~~~~^~~~~~~~~~~~~
Landscape.cc:675:14: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    tot = tot + I[i].size();
          ~~~~^~~~~~~~~~~~~
Landscape.cc: In member function ‘void Landscape::Survive()’:
Landscape.cc:718:29: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
        rs = S[e].RandomState();
             ~~~~~~~~~~~~~~~~^~
Landscape.cc: In member function ‘void Landscape::Reproduce()’:
Landscape.cc:924:40: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    if (CalculateMaleGameteClassVector(k))
                                        ^
Landscape.cc:942:26: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
         R[e].SetToState(j);
                          ^
Landscape.cc:945:37: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
         noff = R[e].PoissonOffspring(1);
                ~~~~~~~~~~~~~~~~~~~~~^~~
Landscape.cc:991:22: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       tmpI.SetClass(j);
                      ^
Landscape.cc: In member function ‘void Landscape::Extirpate()’:
Landscape.cc:1070:20: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    if (p[Habitat(cl)])
                    ^
Landscape.cc: In member function ‘void Landscape::CompressInd()’:
Landscape.cc:1081:12: warning: conversion to ‘int’ from ‘std::vector<DemoClass>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz=I.size();
      ~~~~~~^~
Landscape.cc: In member function ‘void Landscape::CarryState(size_t, int)’:
Landscape.cc:1096:53: warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   if (densdepdemo == 1) max = int(floor(0.5 + maxsz*1.1));
                                                     ^~~
Landscape.cc:1102:28: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       numdel = (I[i].size()-max);
                ~~~~~~~~~~~~^~~~~
Landscape.cc: In member function ‘void Landscape::HabCarry(int)’:
Landscape.cc:1135:20: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       h = Habitat(j);
                    ^
Landscape.cc:1136:44: warning: conversion to ‘__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type {aka double}’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       CarryState(size_t((prop[h])*I[j].size()),j);
                                   ~~~~~~~~~^~
Landscape.cc:1136:49: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       CarryState(size_t((prop[h])*I[j].size()),j);
                                                 ^
Landscape.cc: In member function ‘void Landscape::LambdaAdjust(int)’:
Landscape.cc:1167:31: warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
     CarryState((int)(I[l].size()*adjrate+0.5),l);
                      ~~~~~~~~~^~
Landscape.cc:1180:34: warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
        CarryState((int)(I[l].size()*adjrate+0.5),l);
                         ~~~~~~~~~^~
Landscape.cc: In member function ‘void Landscape::LandCarry()’:
Landscape.cc:1195:37: warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       CarryState(size_t(pr*I[j].size()),j);
                            ~~~~~~~~~^~
Landscape.cc:1195:42: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       CarryState(size_t(pr*I[j].size()),j);
                                          ^
Landscape.cc: In function ‘std::istream& operator>>(std::istream&, Landscape&)’:
Landscape.cc:1354:23: warning: conversion to ‘char’ from ‘std::basic_istream<char>::int_type {aka int}’ may alter its value [-Wconversion]
       tc = stream.peek();
            ~~~~~~~~~~~^~
Landscape.cc: In member function ‘double Landscape_statistics::GenLength()’:
Landscape.cc:1657:49: warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    gensiz = gensiz + I[i].GenLength(t)*I[i].size();
                                        ~~~~~~~~~^~
Landscape.cc:1658:38: warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    totparents= totparents + I[i].size();
                             ~~~~~~~~~^~
Landscape.cc: In member function ‘std::vector<int> Landscape_statistics::Rmat(int)’:
Landscape.cc:1732:24: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
     for (p=0;p<Atbls[sz]->getPloidy();p++)
                        ^
Landscape.cc:1737:28: warning: conversion to ‘std::vector<int>::value_type {aka int}’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
         retval.push_back(sz);//locus
                            ^
Landscape.cc: In member function ‘void Landscape::LambdaAdjust(int)’:
Landscape.cc:1180:28: warning: ‘l’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        CarryState((int)(I[l].size()*adjrate+0.5),l);
                            ^
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c PackedIndividual.cc -o PackedIndividual.o
PackedIndividual.cc: In member function ‘void PackedIndividual::Death(int, AlleleLookTbl&)’:
PackedIndividual.cc:304:18: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       if (Atbls[i]->getPloidy()==1)
                  ^
PackedIndividual.cc:306:11: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    Atbls[i]->KillAlleleCopy(G[ ((i * MAXPLOIDY) + 0) ],t);
           ^
PackedIndividual.cc:308:18: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       if (Atbls[i]->getPloidy()==2)
                  ^
PackedIndividual.cc:310:11: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    Atbls[i]->KillAlleleCopy(G[ ((i * MAXPLOIDY) + 0) ],t);
           ^
PackedIndividual.cc:311:11: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    Atbls[i]->KillAlleleCopy(G[ ((i * MAXPLOIDY) + 1) ],t);
           ^
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c RandLib.cc -o RandLib.o
RandLib.cc: In member function ‘int RandLib::unirange(int)’:
RandLib.cc:128:7: warning: unused variable ‘rv’ [-Wunused-variable]
   int rv;
       ^~
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c SiteObj.cc -o SiteObj.o
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c TransMat.cc -o TransMat.o
TransMat.cc: In member function ‘void TransMat::SetRandomToStateVec(double)’:
TransMat.cc:106:19: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       SetToState(i);
                   ^
TransMat.cc:110:36: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   RandLibObj.SetDiscreteLookup(p,sz+1);
                                  ~~^~
TransMat.cc: In member function ‘void TransMat::SetRandomFromStateVec()’:
TransMat.cc:128:36: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   RandLibObj.SetDiscreteLookup(p,sz+1);
                                  ~~^~
TransMat.cc: In member function ‘size_t TransMat::PoissonOffspring(double)’:
TransMat.cc:149:16: warning: conversion to ‘float’ from ‘double’ may alter its value [-Wfloat-conversion]
   val = Value()*eigenratio;
         ~~~~~~~^~~~~~~~~~~
TransMat.cc: In member function ‘int TransMat::AnyFrom(size_t)’:
TransMat.cc:164:19: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       SetToState(i);
                   ^
TransMat.cc: In function ‘std::ostream& operator<<(std::ostream&, TransMat&)’:
TransMat.cc:299:22: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       TM.SetToState(i);
                      ^
TransMat.cc: In function ‘std::ostream& operator<<(std::ostream&, DemoVec&)’:
TransMat.cc:329:16: warning: conversion to ‘int’ from ‘std::vector<double>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   sz = d.v.size();
        ~~~~~~~~^~
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c rmetasim.cc -o rmetasim.o
rmetasim.cc: In function ‘void R_to_metasim_loci(SEXP, Landscape_statistics&)’:
rmetasim.cc:263:14: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   sl = strlen(ststr);
        ~~~~~~^~~~~~~
rmetasim.cc:271:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (j=0;j<sl;j++)
            ~^~~
rmetasim.cc:273:29: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
       als.SetSite(ststr[j],j);
                             ^
rmetasim.cc: In function ‘SEXPREC* metasim_to_R_loci(Landscape_statistics&)’:
rmetasim.cc:768:17: warning: conversion to ‘int’ from ‘std::vector<int>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
  an = aindx.size();
       ~~~~~~~~~~^~
rmetasim.cc: In function ‘SEXPREC* l2w(SEXP, SEXP)’:
rmetasim.cc:1186:15: warning: conversion to ‘int’ from ‘std::vector<int>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
   l=inmat.size();
     ~~~~~~~~~~^~
/usr/local/bin/g++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o rmetasim.so AlleleObj.o AlleleTbl.o BaseObj.o Democlass.o FastAllele.o FastSeqAllele.o Genotype.o Landscape.o PackedIndividual.o RandLib.o SiteObj.o TransMat.o rmetasim.o -fopenmp -lgomp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmetasim/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
   ‘ApplyCarryToStage.Rmd’ using ‘UTF-8’ 
   ‘CreatingLandscapes.Rmd’ using ‘UTF-8’ 
   ‘Sexuality-and-mating.Rmd’ using ‘UTF-8’ 
   ‘Simulating.Rmd’ using ‘UTF-8’ 
   ‘rmetasim.Rmd’ using ‘UTF-8’ 
** testing if installed package can be loaded
* DONE (rmetasim)

Result in a functional install

  1. Using devtools::install("rmetasim-master")
Installing rmetasim
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/Users/thierry/Dropbox/r_packages/stackr_ressources/testing_functions/test_grur/rmetasim-master'  \
  --library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' --install-tests 

* installing *source* package ‘rmetasim’ ...
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'default/America/Montreal'
** libs
/usr/local/bin/g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include  -fopenmp -std=c++11 -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c AlleleObj.cc -o AlleleObj.o
AlleleObj.cc:15:9: fatal error: RandLib.h: No such file or directory
 #include<RandLib.h>
         ^~~~~~~~~~~
compilation terminated.
make: *** [AlleleObj.o] Error 1
ERROR: compilation failed for package ‘rmetasim’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmetasim’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmetasim’
Error: Command failed (1)

Not installing the package.
I'm sure it's me doing something wrong, but I'm stuck.

Thanks for the help
Thierry

The attached package installs without error for me in the devel version of devtools. I would suggest using that if you run into this issue again.

devtools::install_github("hadley/devtools")

much appreciated Jim

Cheers
Thierry