stan-dev / stan-dev/rstan

Compilation error with latest CRAN packages (and R 3.5.2)

Open
#666 15 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

Compilation error with a test execution of rstan after successful package installation.

Description:

Initially discovered when installing prophet (see https://github.com/facebook/prophet/issues/1027) with a new host. Installations on previous versions of packages was successful, but the latest version fails.

Reproducible Steps:

With R 3.5.2-2 (Enterprise Linux 7 package) on CentOS 7

install.packages('rstan')
library('rstan')
model_code <- 'parameters {real y;} model {y ~ normal(0,1);}'
fit <- stan(model_code=model_code)
mean(extract(fit)$y)
Current Output:
> library('rstan')
Loading required package: ggplot2
Loading required package: StanHeaders
rstan (Version 2.18.2, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
> model_code <- 'parameters {real y;} model {y ~ normal(0,1);}'
> fit <- stan(model_code=model_code)
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from /usr/lib64/R/library/BH/include/boost/random/detail/integer_log2.hpp:19:0,
                 from /usr/lib64/R/library/BH/include/boost/random/detail/int_float_pair.hpp:26,
                 from /usr/lib64/R/library/BH/include/boost/random/exponential_distribution.hpp:27,
                 from /usr/lib64/R/library/BH/include/boost/random/gamma_distribution.hpp:25,
                 from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_rng.hpp:5,
                 from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat.hpp:292,
                 from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12,
                 from /usr/lib64/R/library/StanHeaders/include/stan/math.hpp:4,
                 from /usr/lib64/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4,
                 from file1316ae24e3.cpp:8:
/usr/lib64/R/library/BH/include/boost/
In addition: Warning message:
In system(cmd, intern = !verbose) :
  running command '/usr/lib64/R/bin/R CMD SHLIB file1316ae24e3.cpp 2> file1316ae24e3.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
> 
Expected Output:

Proper calculation of mean value (should be close to 0)

RStan Version:

2.18.2

R Version:

3.5.2

Operating System:

CentOS 7

Extra info
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] rstan_2.18.2          StanHeaders_2.18.1-10 ggplot2_3.2.0        

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         magrittr_1.5       munsell_0.5.0      colorspace_1.4-1  
 [5] R6_2.4.0           rlang_0.3.4        tools_3.5.2        parallel_3.5.2    
 [9] pkgbuild_1.0.3     grid_3.5.2         gtable_0.3.0       loo_2.1.0         
[13] cli_1.1.0          withr_2.1.2        matrixStats_0.54.0 lazyeval_0.2.2    
[17] assertthat_0.2.1   tibble_2.1.3       crayon_1.3.4       processx_3.3.1    
[21] gridExtra_2.3      callr_3.2.0        ps_1.3.0           inline_0.3.15     
[25] compiler_3.5.2     pillar_1.4.1       scales_1.0.0       prettyunits_1.0.2 
[29] stats4_3.5.2       pkgconfig_2.0.2   
> 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported sequence with R 3.5.2 on CentOS 7: install.packages('rstan'), load rstan, and call stan() with the supplied model code. Inspect the compileCode and R CMD SHLIB error output, then verify the fix by confirming that mean(extract(fit)$y) completes and is close to 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.