简体   繁体   中英

Compilation error trying to install packages on R4.0 using RTools

I need to install the package 'yags' to fit GEEs. However, I have issues during the installation process: and the code returns an error. (I am using R version 4.0.0 (2020-04-24), Platform: x86_64-w64-mingw32/x64 (64-bit) and also have the latest versions of RStudio and RTools installed)

install.packages("yags", repos="http://R-Forge.R-project.org", type="source")

And the error:

** using staged installation
** libs

*** arch - i386
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c yags.cc -o yags.o
yags.cc:2476:2: warning: "/*" within comment [-Wcomment]
  /* extern "C" {

yags.cc:2477:2: warning: "/*" within comment [-Wcomment]
  /* void democc( int* n, double* xin, double* xout )

yags.cc:2478:2: warning: "/*" within comment [-Wcomment]
  /*  {

yags.cc:2479:2: warning: "/*" within comment [-Wcomment]
  /*  matrix dumtim = transp(make_row(0.0,2.0,4.0,6.0));

yags.cc:2480:2: warning: "/*" within comment [-Wcomment]
  /*  matrix Xin = from_S(xin, *n, *n);

yags.cc:2481:2: warning: "/*" within comment [-Wcomment]
  /*  //set_el(Xin,0,0) = 491.3626;

yags.cc:2482:2: warning: "/*" within comment [-Wcomment]
  /*  matrix Z = LDLt(Xin);

yags.cc:2483:2: warning: "/*" within comment [-Wcomment]
  /*  //to_S(form_diag(extract_diag(Z)),xout);

yags.cc:2484:2: warning: "/*" within comment [-Wcomment]
  /*  //to_S(lowutri(Z),xout);

yags.cc:2485:2: warning: "/*" within comment [-Wcomment]
  /*  //matrix Ri = exinv(mat11(.5),3,mat11(0.));

yags.cc:2486:2: warning: "/*" within comment [-Wcomment]
  /*  matrix Ri = fominv(mat11(.5),4,dumtim);

yags.cc:2487:2: warning: "/*" within comment [-Wcomment]
  /*  matrix ZZ = diffL( exinv, mat11(.33333) , 4, dumtim, 0.000001 );

yags.cc:2488:2: warning: "/*" within comment [-Wcomment]
  /*

yags.cc:2489:2: warning: "/*" within comment [-Wcomment]
  /* GetUjStruc( dB, JJ, BB, fominv, mat11(.33333), 4, dumtim, .000001 )

yags.cc:2490:2: warning: "/*" within comment [-Wcomment]
  /*

yags.cc:2491:2: warning: "/*" within comment [-Wcomment]
  /*  to_S(JJ,xout);

yags.cc:2492:2: warning: "/*" within comment [-Wcomment]
  /*  }

yags.cc:2493:2: warning: "/*" within comment [-Wcomment]
  /* }  */

yags.cc: In function 'matrix transp(matrix)':
yags.cc:196:10: warning: variable 'look' set but not used [-Wunused-but-set-variable]
  double *look, *load;
          ^~~~
yags.cc: In function 'matrix operator/(matrix&, matrix&)':
yags.cc:472:7: warning: unused variable 'a2c' [-Wunused-variable]
   int a2c = arg2.cols();
       ^~~
yags.cc: In function 'matrix delete_col(matrix, int)':
yags.cc:558:6: warning: unused variable 'ncop' [-Wunused-variable]
  int ncop, nresel, skip;
      ^~~~
yags.cc:558:12: warning: unused variable 'nresel' [-Wunused-variable]
  int ncop, nresel, skip;
            ^~~~~~
yags.cc:558:20: warning: unused variable 'skip' [-Wunused-variable]
  int ncop, nresel, skip;
                    ^~~~
yags.cc:559:10: warning: unused variable 'resbase' [-Wunused-variable]
  double *resbase, *Xbase;
          ^~~~~~~
yags.cc:559:20: warning: unused variable 'Xbase' [-Wunused-variable]
  double *resbase, *Xbase;
                    ^~~~~
yags.cc: In function 'int split(matrix&, matrix&, matrix*)':
yags.cc:1223:12: warning: unused variable 'j' [-Wunused-variable]
  int i=0 , j=0 , k=0, start=0, end=0, len=1;
            ^
yags.cc: In function 'matrix* split(matrix&, matrix&)':
yags.cc:1258:12: warning: unused variable 'j' [-Wunused-variable]
  int i=0 , j=0 , k=0, start=0, end=0, len=1;
            ^
yags.cc: In function 'matrix mult_like_S(matrix, matrix)':
yags.cc:1576:11: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   if (nc1 == 1 & nc2 >= 1) { NC = nc2; confto2 = 1; }
       ~~~~^~~~
yags.cc:1577:16: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   else if (nc2 == 1 & nc1 >=1 ) {NC = nc1; confto2 = 0; }
            ~~~~^~~~
yags.cc: In function 'matrix UJ_equi_eval(matrix, matrix, matrix, double, int, matrix)':
yags.cc:2055:11: warning: unused variable 'rho' [-Wunused-variable]
    double rho = alpin.el(0,0);
           ^~~
yags.cc:2057:11: warning: unused variable 'dUdr' [-Wunused-variable]
    double dUdr = 0.;
           ^~~~
yags.cc: In function 'void yags_engine(int*, int*, int*, double*, double*, double*, double*, double*, double*, int*, double*, int*, int*, double*, double*, double*, double*, double*, double*, double*, double*, double*, int*, int*, double*, double*, int*, double*, double*, double*, double*, double*, double*, int*)':
yags.cc:2220:18: error: overloaded function with no contextual type information
     mu = (void *)exp;
                  ^~~
yags.cc:2221:24: error: overloaded function with no contextual type information
     dmu_deta = (void *)exp;
                        ^~~
yags.cc:2232:18: error: overloaded function with no contextual type information
     mu = (void *)exp;
                  ^~~
yags.cc:2233:24: error: overloaded function with no contextual type information
     dmu_deta = (void *)exp;
                        ^~~
yags.cc:2250:18: error: overloaded function with no contextual type information
     mu = (void *)exp;
                  ^~~
yags.cc:2251:24: error: overloaded function with no contextual type information
     dmu_deta = (void *)exp;
                        ^~~
yags.cc:2256:18: error: overloaded function with no contextual type information
     mu = (void *)exp;
                  ^~~
yags.cc:2257:24: error: overloaded function with no contextual type information
     dmu_deta = (void *)exp;
                        ^~~
yags.cc:2360:15: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
    while (del > *tol & iter < *maxiter )
           ~~~~^~~~~~
yags.cc:2370:18: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
     if (*corcode == UJ_equimart | *fixscale == 1) phi = 1.0;
         ~~~~~~~~~^~~~~~~~~~~~~~
yags.cc:2334:8: warning: unused variable 'cc' [-Wunused-variable]
    int cc = Xin.cols();
        ^~
yags.cc:2275:12: warning: unused variable 'User_cor' [-Wunused-variable]
  const int User_cor = 9;
            ^~~~~~~~
yags.cc:2206:9: warning: statement will never be executed [-Wswitch-unreachable]
   printf("famco %d\n", *famcode);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [C:/PROGRA~1/R/R-40~1.0/etc/i386/Makeconf:227: yags.o] Error 1
ERROR: compilation failed for package 'yags'
* removing 'C:/Users/Morgane/Documents/R/win-library/4.0/yags'
Warning in install.packages :
  installation of package ‘yags’ had non-zero exit status

Would anyone have a clue what might be going wrong?

I know this particular package requires 'multicore' as a dependency so I tried installing this package beforehand using the archives on CRAN, but also get an error message of the same type:

install.packages("https://cran.r-project.org/src/contrib/Archive/multicore/multicore_0.1-1.tar.gz", repos=NULL, type="source")

Error:

(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/src/contrib/Archive/multicore/multicore_0.1-1.tar.gz'
Content type 'application/x-gzip' length 12497 bytes (12 KB)
downloaded 12 KB

* installing *source* package 'multicore' ...
** using staged installation
** libs

*** arch - i386
"C:/rtools40/mingw32/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c fork.c -o fork.o
fork.c:13:10: fatal error: sys/select.h: No such file or directory
 #include <sys/select.h>
          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-40~1.0/etc/i386/Makeconf:222: fork.o] Error 1
ERROR: compilation failed for package 'multicore'
* removing 'C:/Users/Morgane/Documents/R/win-library/4.0/multicore'
Warning in install.packages :
  installation of package ‘C:/Users/Morgane/AppData/Local/Temp/Rtmp2rFgVC/downloaded_packages/multicore_0.1-1.tar.gz’ had non-zero exit status

UPDATE (Leaving the initial question up in case anyone encounters the same problem)

I contacted the author of the yags package and installing it from GitHub rather than from R-Forge repository worked:

devtools::install_github("vjcitn/yags")

Both packages are not anymore standard R packages, so there is not guarantee that they can be installed by "end users". R-Forge is a development server and package "multicore" was archived. CRAN suggests to use package parallel instead. As parallel is a base packagee, it is already there and does not need to be installed.

Then let's go to package yags : looking at R-Forge we find

Version: 6.1-13 | Last change: 2011-04-27 05:07:10+02

so it seems rather outdated. I would therefore recommend to either contact the original package author, or to look for an alternative and probably more recent implementation, eg rjags or to search the net for gee R cran or jags R .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM