stan-dev / rstanarm

rstanarm R package for Bayesian applied regression modeling
https://mc-stan.org/rstanarm
GNU General Public License v3.0
387 stars 132 forks source link

Rstanarm does not build on windows because of CXX14 flag #325

Open VeenDuco opened 5 years ago

VeenDuco commented 5 years ago

Summary:

Due to the requirement of CXX14 since bd717c0 the package does not compile, giving the following error:

Error in .shlib_internal(args) : 
  C++14 standard requested but CXX14 is not defined

Description:

Latest version of RTools is installed (3.5.0.4), seems to contain GCC version 4.9.3, which according to this link does not support all features of C++14.

NB: I found this issue because I wanted to create a package with precompiled models via rstantools, which seems to depend on the makevars.win from rstanarm. Here, changing CXX14 to CXX11 seems to fix the issue.

Reproducible Steps:

devtools::install_github("stan-dev/rstanarm")
Downloading GitHub repo stan-dev/rstanarm@master
√  checking for file 'C:\Users\5507553\AppData\Local\Temp\Rtmp0YKDkX\remotes23382edd7cb8\stan-dev-rstanarm-a37f9b3/DESCRIPTION' ...
-  preparing 'rstanarm': (683ms)
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  running 'cleanup.win' (789ms)
-  checking for LF line-endings in source and make files and shell scripts (847ms)
-  checking for empty or unneeded directories
-  looking to see if a 'data/datalist' file should be added
-  building 'rstanarm_2.18.2.tar.gz'
   Warning: file 'rstanarm/cleanup' did not have execute permissions: corrected

* installing *source* package 'rstanarm' ...
** libs

*** arch - i386
Error in .shlib_internal(args) : 
  C++14 standard requested but CXX14 is not defined
* removing 'C:/Program Files/R/R-3.5.1/library/rstanarm'
* restoring previous 'C:/Program Files/R/R-3.5.1/library/rstanarm'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/5507553/AppData/Local/Temp/Rtmp0YKDkX/file23384a3c5fec/rstanarm_2.18.2.tar.gz’ had non-zero exit status

RStanARM Version:

2.18.2

R Version:

3.5.1

Operating System:

Windows 10 10.0.15063

bgoodri commented 5 years ago

To build rstanarm from source on Windows, you would need to have something like

CXX14 = $(BINPREF)g++ -m$(WIN)

in your ~/.R/Makevars or ~/.R/Makevars.win file. Your package will be fine on CRAN with CXX_STD = CXX14 in src/Makevars and src/Makevars.win but be sure to put

STANHEADERS_SRC = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "message()" -e "cat(system.file('include', 'src', package = 'StanHeaders', mustWork = TRUE))" -e "message()" | grep "StanHeaders")

in them rather than the previous stuff with --vanilla because that could fail if the .Rprofile file sets the library paths to some non-default values.

On Mon, Nov 26, 2018 at 6:27 AM Duco Veen notifications@github.com wrote:

Summary:

Due to the requirement of CXX14 since bd717c0 https://github.com/stan-dev/rstanarm/commit/bd717c03869066270434ce48824886498ce05356 the package does not compile, giving the following error:

Error in .shlib_internal(args) : C++14 standard requested but CXX14 is not defined

Description:

Latest version of RTools is installed (3.5.0.4), seems to contain GCC version 4.9.3, which according to this link https://en.cppreference.com/w/cpp/compiler_support does not support all features of C++14.

NB: I found this issue because I wanted to create a package with precompiled models via rstantools https://github.com/stan-dev/rstantools, which seems to depend on the makevars.win from rstanarm https://github.com/stan-dev/rstantools/blob/6f5cc38423beb4077d6c114d438601905ac989e7/R/rstan_package_skeleton.R#L155. Here, changing CXX14 to CXX11 seems to fix the issue. Reproducible Steps:

devtools::install_github("stan-dev/rstanarm")

Downloading GitHub repo stan-dev/rstanarm@master √ checking for file 'C:\Users\5507553\AppData\Local\Temp\Rtmp0YKDkX\remotes23382edd7cb8\stan-dev-rstanarm-a37f9b3/DESCRIPTION' ...

  • preparing 'rstanarm': (683ms) √ checking DESCRIPTION meta-information ...

  • cleaning src

  • running 'cleanup.win' (789ms)

  • checking for LF line-endings in source and make files and shell scripts (847ms)

  • checking for empty or unneeded directories

  • looking to see if a 'data/datalist' file should be added

  • building 'rstanarm_2.18.2.tar.gz' Warning: file 'rstanarm/cleanup' did not have execute permissions: corrected

  • installing source package 'rstanarm' ... ** libs

*** arch - i386 Error in .shlib_internal(args) : C++14 standard requested but CXX14 is not defined

  • removing 'C:/Program Files/R/R-3.5.1/library/rstanarm'
  • restoring previous 'C:/Program Files/R/R-3.5.1/library/rstanarm' In R CMD INSTALL Error in i.p(...) : (converted from warning) installation of package ‘C:/Users/5507553/AppData/Local/Temp/Rtmp0YKDkX/file23384a3c5fec/rstanarm_2.18.2.tar.gz’ had non-zero exit status

RStanARM Version:

2.18.2 R Version:

3.5.1 Operating System:

Windows 10 10.0.15063

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstanarm/issues/325, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOrqr-EBE7Kz05-qBXM78qpJ2k7lIAwks5uy9AmgaJpZM4Yy1hX .