My Rstan package installs on Linux but not on Windows

I have a Rstan package which installs correctly on Linux but not on Windows, for a problem I cannot find info online for.




Downloading GitHub repo stemangiola/ppcSeq@master
✓  checking for file 'C:\Users\mangiola.s\AppData\Local\Temp\Rtmp4UpRT7\remotes23f0227b404c\stemangiola-ppcSeq-e2f5755/DESCRIPTION' ...
─  preparing 'ppcSeq':
✓  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a 'data/datalist' file should be added
─  building 'ppcSeq_0.0.0.9000.tar.gz' (5.2s)
   Warning: file 'ppcSeq/configure' did not have execute permissions: corrected
* installing *source* package 'ppcSeq' ...
** using staged installation

   WARNING: this package has a configure script
         It probably needs manual configuration

** libs

*** arch - i386

C:/RBuildTools/3.5/mingw_32/bin/g++ -m32 -std=c++1y -march=native -mtune=native  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -I"../inst/include" -I"C:/Program Files/R/R-3.6.0/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I"C:/Program Files/R/R-3.6.0/library/BH/include" -I"C:/Program Files/R/R-3.6.0/library/Rcpp/include" -I"C:/Program Files/R/R-3.6.0/library/RcppEigen/include" -I"C:/Program Files/R/R-3.6.0/library/rstan/include" -I"C:/Program Files/R/R-3.6.0/library/StanHeaders/include"   -march=native     -O3 -march=native -c RcppExports.cpp -o RcppExports.o
C:/RBuildTools/3.5/mingw_32/bin/g++ -m32 -std=c++1y -march=native -mtune=native -shared -s -static-libgcc -o ppcSeq.dll tmp.def RcppExports.o -LC:/PROGRA~1/R/R-36~1.0/bin/i386 -lR
RcppExports.o:RcppExports.cpp:(.rdata+0x3c): undefined reference to `_rcpp_module_boot_stan_fit4negBinomial_MPI_mod'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'ppcSeq'
* removing 'C:/Program Files/R/R-3.6.0/library/ppcSeq'
* restoring previous 'C:/Program Files/R/R-3.6.0/library/ppcSeq'
Error: Failed to install 'ppcSeq' from GitHub:
  (converted from warning) installation of package ‘C:/Users/mangiola.s/AppData/Local/Temp/Rtmp4UpRT7/file23f0140c2f06/ppcSeq_0.0.0.9000.tar.gz’ had non-zero exit status


> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252
[4] LC_NUMERIC=C                       LC_TIME=English_Australia.1252    

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

other attached packages:
[1] rstan_2.19.2       ggplot2_3.2.1      StanHeaders_2.19.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3         pillar_1.4.3       compiler_3.6.0     prettyunits_1.0.2  remotes_2.1.0     
 [6] tools_3.6.0        testthat_2.3.1     digest_0.6.23      pkgbuild_1.0.6     pkgload_1.0.2     
[11] tibble_2.1.3       memoise_1.1.0      lifecycle_0.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.0     curl_4.3          
[21] loo_2.2.0          gridExtra_2.3      dplyr_0.8.3        withr_2.1.2        desc_1.2.0        
[26] fs_1.3.1           devtools_2.2.1     stats4_3.6.0       tidyselect_0.2.5   rprojroot_1.3-2   
[31] grid_3.6.0         inline_0.3.15      glue_1.3.1         R6_2.4.1           processx_3.4.1    
[36] fansi_0.4.0        sessioninfo_1.1.1  purrr_0.3.3        callr_3.4.0        magrittr_1.5      
[41] matrixStats_0.55.0 backports_1.1.5    scales_1.1.0       ps_1.3.0           ellipsis_0.3.0    
[46] usethis_1.5.1      assertthat_0.2.1   colorspace_1.4-1   lazyeval_0.2.2     munsell_0.5.0     
[51] crayon_1.3.4    


> .libPaths()
[1] "C:/Program Files/R/R-3.6.0/library"


It looks like you have a configure file but not That should come with rstantools too, but in any case it’s just this:

#! /bin/sh
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rstantools::rstan_config()"

Thanks a lot,

could I ask to elaborate?

Let’s imagine I have a Windows user, should I provide instruction for manually building this file (where?) or there is an automated way to do it (that work for Linux apparently but not for Win (?) )

You already have a configure file in the top-level of your package, you need to put a file there too, which will be picked up by R when compiling the package on Windows. A user shouldn’t need to do anything.

1 Like