stan-dev / stan-dev/rstan

Compilation error on Centos server on rstan via brms

Open
#661 4 comments 0 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:

I am trying to run a brm model on a linux server that runs perfectly on my local Windows machine, but I keep getting a compilation error. I have read lots of threads that suggest to change my Makevars file, but none have worked so far. Thank you in advance for any help!

Reproducible Steps:

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.10 (Final)

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

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

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

other attached packages:
[1] bayesplot_1.6.0 modelr_0.1.1 tidybayes_1.0.4 brms_2.9.0 Rcpp_1.0.1
[6] rstan_2.18.2 StanHeaders_2.18.1 gridExtra_2.3 ggforce_0.2.2 forcats_0.2.0
[11] stringr_1.4.0 dplyr_0.8.0.1 readr_1.3.1 tidyr_0.8.3 tibble_2.1.1
[16] ggplot2_3.1.0 tidyverse_1.2.1 purrr_0.3.2 broom_0.4.4

loaded via a namespace (and not attached):
[1] nlme_3.1-137 matrixStats_0.54.0 xts_0.11-2
[4] lubridate_1.7.4 threejs_0.3.1 httr_1.3.1
[7] backports_1.1.4 tools_3.5.2 DT_0.5
[10] R6_2.4.0 lazyeval_0.2.2 colorspace_1.4-1
[13] withr_2.1.2 tidyselect_0.2.5 prettyunits_1.0.2
[16] mnormt_1.5-5 processx_3.3.0 Brobdingnag_1.2-6
[19] compiler_3.5.2 cli_1.0.1 rvest_0.3.2
[22] arrayhelpers_1.0-20160527 shinyjs_1.0 xml2_1.2.0
[25] colourpicker_1.0 scales_1.0.0 dygraphs_1.1.1.6
[28] mvtnorm_1.0-10 psych_1.7.8 ggridges_0.5.1
[31] callr_3.2.0 digest_0.6.18 foreign_0.8-71
[34] base64enc_0.1-3 pkgconfig_2.0.2 htmltools_0.3.6
[37] htmlwidgets_1.3 rlang_0.3.1 readxl_1.3.1
[40] rstudioapi_0.7 shiny_1.0.5 farver_1.1.0
[43] svUnit_0.7-12 zoo_1.8-4 jsonlite_1.6
[46] gtools_3.8.1 crosstalk_1.0.0 inline_0.3.15
[49] magrittr_1.5 loo_2.1.0 Matrix_1.2-15
[52] munsell_0.5.0 abind_1.4-5 stringi_1.4.3
[55] yaml_2.2.0 MASS_7.3-51.1 pkgbuild_1.0.3
[58] plyr_1.8.4 ggstance_0.3.1 grid_3.5.2
[61] promises_1.0.1 parallel_3.5.2 crayon_1.3.4
[64] miniUI_0.1.1.1 lattice_0.20-38 haven_2.1.0
[67] hms_0.4.2 ps_1.3.0 pillar_1.3.1
[70] igraph_1.1.0 markdown_1.0 shinystan_2.5.0
[73] reshape2_1.4.3 stats4_3.5.2 rstantools_1.5.1
[76] glue_1.3.1 tweenr_1.0.1 httpuv_1.5.1
[79] cellranger_1.1.0 gtable_0.3.0 polyclip_1.10-0
[82] assertthat_0.2.1 mime_0.6 xtable_1.8-2
[85] coda_0.19-2 later_0.8.0 rsconnect_0.8.13
[88] rjags_4-8 shinythemes_1.1.2 bridgesampling_0.6-0

Sys.info()
sysname release
"Linux" "2.6.32-696.el6.x86_64"
version nodename
"#1 SMP Tue Mar 21 19:29:05 UTC 2017" "XXXXX"
machine login
"x86_64" "unknown"
user effective_user
"XX" "XX"

devtools::session_info('rstan')
Warning: Your system is mis-configured: ‘/etc/localtime’ is not a symlink
Warning: It is strongly recommended to set envionment variable TZ to ‘America/Los_Angeles’ (or equivalent)
Session info -------------------------------------------------------------------------------------
setting value
version R version 3.5.2 (2018-12-20)
system x86_64, linux-gnu
ui RStudio (1.1.456)
language (EN)
collate en_US.UTF-8
tz America/Los_Angeles
date 2019-06-15

Packages -----------------------------------------------------------------------------------------
package * version date source
assertthat 0.2.1 2019-03-21 CRAN (R 3.5.2)
backports 1.1.4 2019-04-10 CRAN (R 3.5.2)
BH 1.69.0-1 2019-01-07 CRAN (R 3.5.2)
callr 3.2.0 2019-03-15 CRAN (R 3.5.2)
checkmate 1.9.1 2019-01-15 CRAN (R 3.5.2)
cli 1.0.1 2018-09-25 CRAN (R 3.5.1)
colorspace 1.4-1 2019-03-18 CRAN (R 3.5.1)
compiler 3.5.2 2019-01-08 local
crayon 1.3.4 2017-09-16 CRAN (R 3.4.3)
desc 1.2.0 2018-05-01 CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 CRAN (R 3.5.2)
fansi 0.4.0 2018-10-05 CRAN (R 3.5.1)
ggplot2 * 3.1.0 2018-10-25 CRAN (R 3.5.2)
glue 1.3.1 2019-03-12 CRAN (R 3.5.1)
graphics * 3.5.2 2019-01-08 local
grDevices * 3.5.2 2019-01-08 local
grid 3.5.2 2019-01-08 local
gridExtra * 2.3 2017-09-09 cran (@2.3)
gtable 0.3.0 2019-03-25 cran (@0.3.0)
inline 0.3.15 2018-05-18 CRAN (R 3.5.2)
labeling 0.3 2014-08-23 CRAN (R 3.4.1)
lattice 0.20-38 2018-11-04 CRAN (R 3.5.2)
lazyeval 0.2.2 2019-03-15 CRAN (R 3.5.1)
loo 2.1.0 2019-03-13 CRAN (R 3.5.2)
magrittr 1.5 2014-11-22 CRAN (R 3.4.1)
MASS 7.3-51.1 2018-11-01 CRAN (R 3.5.2)
Matrix 1.2-15 2018-11-01 CRAN (R 3.5.2)
matrixStats 0.54.0 2018-07-23 CRAN (R 3.5.2)
methods * 3.5.2 2019-01-08 local
mgcv 1.8-26 2018-11-21 CRAN (R 3.5.2)
munsell 0.5.0 2018-06-12 CRAN (R 3.5.1)
nlme 3.1-137 2018-04-07 CRAN (R 3.5.2)
parallel 3.5.2 2019-01-08 local
pillar 1.3.1 2018-12-15 CRAN (R 3.5.1)
pkgbuild 1.0.3 2019-03-20 CRAN (R 3.5.2)
pkgconfig 2.0.2 2018-08-16 CRAN (R 3.5.1)
plyr 1.8.4 2016-06-08 CRAN (R 3.5.1)
prettyunits 1.0.2 2015-07-13 CRAN (R 3.5.2)
processx 3.3.0 2019-03-10 CRAN (R 3.5.2)
ps 1.3.0 2018-12-21 CRAN (R 3.5.2)
R6 2.4.0 2019-02-14 CRAN (R 3.5.2)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.1)
Rcpp * 1.0.1 2019-03-17 CRAN (R 3.5.1)
RcppEigen 0.3.3.5.0 2018-11-24 CRAN (R 3.5.2)
reshape2 1.4.3 2017-12-11 CRAN (R 3.5.1)
rlang 0.3.1 2019-01-08 CRAN (R 3.5.1)
rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.3)
rstan * 2.18.2 2018-11-07 CRAN (R 3.5.2)
scales 1.0.0 2018-08-09 CRAN (R 3.5.1)
StanHeaders * 2.18.1 2019-01-28 CRAN (R 3.5.2)
stats * 3.5.2 2019-01-08 local
stats4 3.5.2 2019-01-08 local
stringi 1.4.3 2019-03-12 CRAN (R 3.5.1)
stringr * 1.4.0 2019-02-10 CRAN (R 3.5.2)
tibble * 2.1.1 2019-03-16 CRAN (R 3.5.1)
tools 3.5.2 2019-01-08 local
utf8 1.1.4 2018-05-24 CRAN (R 3.5.2)
utils * 3.5.2 2019-01-08 local
viridisLite 0.3.0 2018-02-01 cran (@0.3.0)
withr 2.1.2 2018-03-15 cran (@2.1.2)

Here is what is in my .~/R/Makevars file

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++ -std=c++1y

g++ --version
g++ (GCC) 8.3.0

Here is the code that works on my windows machine

create a generated quantities block for Topt

stanvars <- stanvar(scode = "real Topt;
Topt = (b_Eh[1] * b_Th[1]) / (b_Eh[1] + (0.0000862 * b_Th[1] * log((b_Eh[1] / b_E[1]) - 1)));",
block = "genquant")
#Sys.setenv(USE_CXX14 = 1) #tried this and it did not work
fit1<-brm(
bf(log.rate ~ lnc + log(exp(E/.0000862*(1/299.15 - 1/K))) +log(1/(1 + exp(Eh/.0000862*(1/Th - 1/K)))),
lnc ~ 1 + (1|Organism.ID), Eh1, Th1 , E~1 , nl = TRUE ),
data = Acali,
family = student(),
prior = c(
prior(normal(0,10), nlpar = "E", lb = 0), # set the priors
prior(normal(0,10), nlpar = "Eh", lb = 0),
prior(normal(320, 10), nlpar = "Th", lb = 0),
prior(normal(0, 10), nlpar = "lnc", lb = 0)
), control = list(adapt_delta = 0.99, max_treedepth = 20), # force stan to take smaller steps to reduce divergent errors
cores = 4, chains = 4, seed = 126, iter = 3000, warmup = 2000,stanvars = stanvars)

Current Output:

Compiling the C++ model
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /home/ns/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include/Eigen/Core:383,
from /home/ns/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include/Eigen/Dense:1,
from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:14,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4,
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 file3878125450029.cpp:8:
/home/ns/R/x86_64-re
In addition: Warning message:
In system(cmd, intern = !verbose) :

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /home/ns/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include/Eigen/Core:383,
from /home/ns/R/x86_64-redhat-linux-gnu-library/3.5/RcppEigen/include/Eigen/Dense:1,
from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/core.hpp:14,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4,
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 file3878125450029.cpp:8:
/home/ns/R/x86_64-re
Error in sink(type = "output") : invalid connection

RStan Version:

The version of RStan you are running (e.g., from packageVersion("rstan"))
packageVersion("rstan")

[1] ‘2.18.2’

R Version:

The version of R you are running (e.g., from R.version.string)
R version 3.5.2 (2018-12-20)

Operating System:

Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.10 (Final)

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

Begin by reproducing the brm call on the reported CentOS 6.10 and R 3.5.2 setup, then capture the complete compileCode output because the reported compiler diagnostics are truncated. Inspect the shown ~/.R/Makevars settings and the rstan/StanHeaders compilation path; done means identifying a reproducible cause and documenting a verified fix or compatibility requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
centos, cpp, r
Domain
build-system, compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
22/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.