RStan Compile Error

Went to compile some RStan code this morning and it generated a compile error. This code has had no compilation problems before today. I believe that the problem started after updating all my R packages this morning. Here is the error:

Error in compileCode(f, code, language = language, verbose = verbose) :
960 | enum { | ^/usr/bin/ld: /home/thomas/R/x86_64-pc-linux-gnu-library/4.0/rstan/lib//libStanServices.a(stan_fit.o): relocation R_X86_64_PC32 against undefined hidden symbol `_ZTCN5boost10wrapexceptINS_4math14rounding_errorEEE0_NS_16exception_detail10clone_implINS4_19error_info_injectorIS2_EEEE’ can not be used when making a shared object/usr/bin/ld: final link failed: bad valuecollect2: error: ld returned 1 exit statusmake: *** [/usr/share/R/share/make/shlib.mk:10: file830c9a0e68.so] Error 1

Here is R:

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20.1

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libmkl_rt.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 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 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] metRology_0.9-28-1 rstan_2.21.2 ggplot2_3.3.3 StanHeaders_2.21.0-7 scales_1.1.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 DEoptimR_1.0-8 pillar_1.4.7 compiler_4.0.3 prettyunits_1.1.1 tools_4.0.3 pkgbuild_1.2.0 jsonlite_1.7.2
[9] lifecycle_0.2.0 tibble_3.0.4 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.10 cli_2.2.0 rstudioapi_0.13 parallel_4.0.3
[17] curl_4.3 loo_2.4.1 gridExtra_2.3 withr_2.3.0 dplyr_1.0.2 generics_0.1.0 vctrs_0.3.6 stats4_4.0.3
[25] grid_4.0.3 tidyselect_1.1.0 robustbase_0.93-7 glue_1.4.2 inline_0.3.17 R6_2.5.0 processx_3.4.5 fansi_0.4.1
[33] callr_3.5.1 purrr_0.3.4 magrittr_2.0.1 MASS_7.3-53 codetools_0.2-18 matrixStats_0.57.0 ps_1.5.0 ellipsis_0.3.1
[41] assertthat_0.2.1 colorspace_2.0-0 numDeriv_2016.8-1.1 V8_3.4.0 RcppParallel_5.0.2 munsell_0.5.0 crayon_1.3.4

And my OS:

System: Kernel: 5.4.0-60-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.8.5
Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal

The update of the BH package from 1.72.0-3 to 1.75.0-0 appears to have caused the problem. As a side note, no Stan code would compile – not even the bernoulli example from the manual.

Thanks Thomas, that’s indeed the case. You’ll need to reinstall RStan and StanHeaders, so that the packages are compiled against the updated headers in the BH package

2 Likes

your solution worked for me.
Thanks andrjohns

I’m glad to hear that a simple recompile is all that’s needed … can someone tell that to the https://launchpad.net/~c2d4u.team/ ? Because they still offer a version compiled last year - which means it doesn’t work in updated systems.

As the maintainer of c2d4u, I have rebuilt the package and rstan-2.21.2-1cran2 is now available. Please let me know if it does not fix the issue (marutterATgmail.com). I don’t use RStan, so if the error continues, I will need some example code to work with.