jtimonen / lgpr

R-package for interpretable nonparametric modeling of longitudinal data using additive Gaussian processes. Contains functionality for inferring covariate effects and assessing covariate relevances. Various models can be specified using a convenient formula syntax.
https://jtimonen.github.io/lgpr-usage/
25 stars 1 forks source link

Cannot compile under Windows #1

Closed StaffanBetner closed 4 years ago

StaffanBetner commented 4 years ago

I am using R 3.6.1 and Rtools 3.5 (latest version, reinstalled it today) but cannot compile, seems to be some kind of incompatibility with the compiler flags.

Messages from g++:

C:/Rtools/mingw_64/bin/g++ -O2 -Wno-unused-variable -Wno-unused-function  -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I"../inst/include" -I"C:/Users/sner0004/rpackages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/Users/sner0004/rpackages/BH/include" -I"C:/Users/sner0004/rpackages/Rcpp/include" -I"C:/Users/sner0004/rpackages/RcppEigen/include" -I"C:/Users/sner0004/rpackages/rstan/include" -I"C:/Users/sner0004/rpackages/StanHeaders/include"   -march=core2     -O3 -Wno-unused-variable -Wno-unused-function -c stanExports_lgp.cc -o stanExports_lgp.o

In file included from C:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/type_traits:35:0,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:4,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/stan/math/prim/arr/meta/is_constant_struct.hpp:4,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/stan/math/prim/mat/meta/is_constant_struct.hpp:4,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/stan/math/prim/mat.hpp:15,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/stan/math/rev/mat.hpp:12,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
                 from C:/Users/sner0004/rpackages/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
                 from C:/Users/sner0004/rpackages/rstan/include/rstan/stan_fit.hpp:35,
                 from C:/Users/sner0004/rpackages/rstan/include/rstan/rstaninc.hpp:3,
                 from stanExports_lgp.h:6,
                 from stanExports_lgp.cc:5:
C:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
jtimonen commented 4 years ago

Have you been able to install rstan or rstanarm? Might be similar issue as this: https://github.com/stan-dev/rstanarm/issues/325 . Have you installed rstan and set your Makevars as explained here https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows?

StaffanBetner commented 4 years ago

Yes, rstan and rstanarm (and brms for that matter) works and runs well.

StaffanBetner commented 4 years ago

... As I run Windows I get precompiled binaries from CRAN. I guess the issue at the rstanarm repo is the same.

bgoodri commented 4 years ago

You have to configure the Windows toolchain if you want to install from source

https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows#configuration

Pintaius commented 4 years ago

I also seem to have a similar error on R Open 3.5 (R 3.5.3), have not been able to compile it despite various attemps at making the Makevar.win file with different settings. With the one on the rstan wiki the error is as follows:

Downloading GitHub repo jtimonen/lgpr@master

√  checking for file 'C:\Users\XXX\AppData\Local\Temp\RtmpCwkSC3\remotes285829a22ea3\jtimonen-lgpr-782d80e/DESCRIPTION' (1.9s)
-  preparing 'lgpr':
√  checking DESCRIPTION meta-information
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts (736ms)
-  checking for empty or unneeded directories
-  building 'lgpr_0.30.5.1.tar.gz'

Warning: file 'lgpr/configure' did not have execute permissions: corrected

Installing package into ‘C:/Rlib’
(as ‘lib’ is unspecified)
* installing *source* package 'lgpr' ...
** libs

C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y  -I"C:/PROGRA~1/MICROS~4/ROPEN~1/R-35~1.3/include" -DNDEBUG -I"../inst/include" -I"C:/Rlib/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/Rlib/BH/include" -I"C:/Rlib/Rcpp/include" -I"C:/Rlib/RcppEigen/include" -I"C:/Rlib/rstan/include" -I"C:/Rlib/StanHeaders/include"   -I"C:/a/w/1/s/vendor/extsoft/include"     -O3 -march=native -mtune=native -c RcppExports.cpp -o RcppExports.o

C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y  -I"C:/PROGRA~1/MICROS~4/ROPEN~1/R-35~1.3/include" -DNDEBUG -I"../inst/include" -I"C:/Rlib/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/Rlib/BH/include" -I"C:/Rlib/Rcpp/include" -I"C:/Rlib/RcppEigen/include" -I"C:/Rlib/rstan/include" -I"C:/Rlib/StanHeaders/include"   -I"C:/a/w/1/s/vendor/extsoft/include"     -O3 -march=native -mtune=native -c stanExports_lgp.cc -o stanExports_lgp.o
In file included from C:/Rlib/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:17:0,
                 from C:/Rlib/StanHeaders/include/stan/math/prim/arr.hpp:46,
                 from C:/Rlib/StanHeaders/include/stan/math/prim/mat.hpp:344,
                 from C:/Rlib/StanHeaders/include/stan/math/rev/mat.hpp:12,
                 from C:/Rlib/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
                 from C:/Rlib/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
                 from C:/Rlib/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
                 from C:/Rlib/rstan/include/rstan/stan_fit.hpp:35,
                 from C:/Rlib/rstan/include/rstan/rstaninc.hpp:3,
                 from stanExports_lgp.h:6,
                 from stanExports_lgp.cc:5:
C:/Rlib/BH/include/boost/numeric/odeint.hpp:31:76: fatal error: boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp: No such file or directory
 #include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp>
                                                                            ^
compilation terminated.
make: *** [C:/PROGRA~1/MICROS~4/ROPEN~1/R-35~1.3/etc/x64/Makeconf:213: stanExports_lgp.o] Error 1
make: *** Waiting for unfinished jobs....
ERROR: compilation failed for package 'lgpr'
* removing 'C:/Rlib/lgpr'
In R CMD INSTALL
Error: Failed to install 'lgpr' from GitHub:
  (converted from warning) installation of package ‘C:/Users/XXX/AppData/Local/Temp/RtmpCwkSC3/file28583078199d/lgpr_0.30.5.1.tar.gz’ had non-zero exit status

I have also checked that the BH package is properly installed and I cannot see any fault. Rstan, Rstanarm and others have also been working for quite a while.

Pintaius commented 4 years ago

Actually, seems that my problem was a side-effect of an issue in the latest CRAN upload of BH (h/t https://discourse.mc-stan.org/t/cannot-compile-package-after-updating-bh-package/12338). After downgrading to the previous version of that package, lgpr is working now!

jtimonen commented 4 years ago

The problem with boost headers has been corrected in BH 1.72.0-2

https://discourse.mc-stan.org/t/cannot-compile-package-after-updating-bh-package/12338/6?u=jtimonen

sessionInfo() for my working Windows setup:


R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lgpr_0.30.5.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3         pillar_1.4.2       compiler_3.6.1     prettyunits_1.0.2  remotes_2.1.0     
 [6] tools_3.6.1        testthat_2.3.0     digest_0.6.23      pkgbuild_1.0.6     pkgload_1.0.2     
[11] tibble_2.1.3       lifecycle_0.1.0    memoise_1.1.0      gtable_0.3.0       pkgconfig_2.0.3   
[16] rlang_0.4.2        cli_2.0.0          rstudioapi_0.10    parallel_3.6.1     curl_4.2          
[21] yaml_2.2.0         loo_2.1.0          gridExtra_2.3      dplyr_0.8.3        withr_2.1.2       
[26] desc_1.2.0         fs_1.3.1           devtools_2.2.1     tidyselect_0.2.5   stats4_3.6.1      
[31] rprojroot_1.3-2    grid_3.6.1         glue_1.3.1         inline_0.3.15      R6_2.4.1          
[36] processx_3.4.1     rstan_2.19.2       sessioninfo_1.1.1  purrr_0.3.3        callr_3.4.0       
[41] ggplot2_3.2.1      magrittr_1.5       MASS_7.3-51.4      codetools_0.2-16   matrixStats_0.55.0
[46] scales_1.1.0       backports_1.1.5    ps_1.3.0           ellipsis_0.3.0     StanHeaders_2.19.0
[51] usethis_1.5.1      rstantools_2.0.0   assertthat_0.2.1   colorspace_1.4-1   lazyeval_0.2.2    
[56] munsell_0.5.0      crayon_1.3.4      
jtimonen commented 4 years ago

I think the most likely reason for people having problems installing on Windows is that R toolchain is not configured, as pointed out by @bgoodri . We dont have any binary versions of lgpr distributed yet, so only way to install is from source. Just having Rtools installed is not enough, you also need to do the "Configuration" step here: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows#configuration.