【问题标题】:Compilation error trying to install packages on R4.0 using RTools尝试使用 RTools 在 R4.0 上安装软件包时出现编译错误
【发布时间】:2020-06-03 12:52:22
【问题描述】:

我需要安装包 'yags' 以适应 GEE。但是,我在安装过程中遇到问题:并且代码返回错误。 (我使用的是 R 版本 4.0.0 (2020-04-24),平台:x86_64-w64-mingw32/x64(64 位),还安装了最新版本的 RStudio 和 RTools)

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

还有错误:

** 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

有人知道可能出了什么问题吗?

我知道这个特定的包需要“多核”作为依赖项,所以我尝试使用 CRAN 上的档案预先安装这个包,但也收到了相同类型的错误消息:

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

错误:

(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

【问题讨论】:

    标签: c++ r compiler-errors installation


    【解决方案1】:

    更新 (留下最初的问题,以防有人遇到同样的问题)

    我联系了 yags 包的作者,并从 GitHub 而不是从 R-Forge 存储库安装它:

    devtools::install_github("vjcitn/yags")

    【讨论】:

      【解决方案2】:

      这两个包都不再是标准的 R 包,因此不能保证它们可以被“最终用户”安装。 R-Forge 是一个开发服务器,并且包“多核”已存档。 CRAN suggests 改为使用包 parallelparallel 是一个基础包,它已经存在,不需要安装。

      然后让我们去打包 yags:查看我们找到的 R-Forge

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

      所以它似乎已经过时了。因此,我建议要么联系原始包作者,要么寻找替代方案并且可能是更新的实现,例如rjags 或在网上搜索gee R cranjags R

      【讨论】:

      • 感谢您的回答。我想专门使用它们的原因是我正在尝试使用之前在一些论文(2011、2016、2017)中描述的方法来分析我的数据。但我会尝试找到一些替代方法:)
      • 好的,那你可以考虑问问作者,或者获取历史工具集,包括R本身。这一切都还在。
      • 完美!谢谢!
      猜你喜欢
      • 1970-01-01
      • 2016-11-23
      • 2021-10-04
      • 2019-11-03
      • 1970-01-01
      • 1970-01-01
      • 2022-12-05
      • 2021-07-25
      • 1970-01-01
      相关资源
      最近更新 更多