Hi all,
I can’t get the example stan model to run example(stan_model, run.dontrun = TRUE)
.
It looks like a multiple definition problem with ld.exe. I’ve tried re-installing R, all my packages, and reinstalling Rtools. I’ve tried installed different versions of R (R.4.0.2, R.4.0.3, R.4.0.0), rolling back packages back to previous versions, updated my makevars file to a variety of different things, none of which have helped.
The code is:
example(stan_model, run.dontrun = TRUE)
The full output is attached, the brief error output is below:
[output.txt|attachment](upload://3KHnGRknSHO1aE5IDE8n4aO9HFz.txt) (35.4 KB) Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
C:/rtools40/usr/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/SLAFolder/R/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::P1'; file1988d8e1c9b.o:file1988d8e1c9b.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/rtools40/usr/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/SLAFolder/R/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::QS'; file1988d8e1c9b.o:file1988d8e1c9b.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeE
Note this output occurs with no Makevars file, but I’ve also tried running this again with a variety of options set in the Makevars file, containing different versions of the following, based on potential solutions I found online. In short, none of these made a difference anyway, so I’ve copied the output from above without any Makevars file settings. But, here are the different options I tried in Makevars (not really sure what I’m doing here, so I tried everything that made sense to me at the time based on what I read).
#LDFLAGS += -Wl,--allow-multiple-definition
#CXX14 = "C:\rtools40\usr\mingw_64\bin\g++.exe" -m$(WIN) -std=c++1y
#CXX14FLAGS += -mtune=native -O3, --allow-multiple-definition -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
#CXX11FLAGS=-O3 -march=native
#CXX14FLAGS=-O3 -march=native
#CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function
#CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
#CXX14 = g++
Session info is:
- Session info ---------------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 4.0.2 (2020-06-22)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_Australia.1252
ctype English_Australia.1252
tz Australia/Sydney
date 2021-01-12
- Packages -------------------------------------------------------------------------------------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.3)
backports 1.2.0 2020-11-02 [1] CRAN (R 4.0.3)
BH 1.75.0-0 2021-01-11 [1] CRAN (R 4.0.2)
brio 1.1.0 2020-08-31 [1] CRAN (R 4.0.3)
callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.3)
checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.3)
cli 2.2.0 2020-11-20 [1] CRAN (R 4.0.3)
colorspace 2.0-0 2020-11-11 [1] CRAN (R 4.0.3)
crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.3)
curl 4.3 2019-12-02 [1] CRAN (R 4.0.3)
desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.3)
diffobj 0.3.3 2021-01-07 [1] CRAN (R 4.0.3)
digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3)
ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.3)
evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.3)
fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.3)
farver 2.0.3 2020-01-16 [1] CRAN (R 4.0.3)
ggplot2 * 3.3.3 2020-12-30 [1] CRAN (R 4.0.3)
glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.3)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.3)
gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.3)
inline 0.3.17 2020-12-01 [1] CRAN (R 4.0.3)
isoband 0.2.3 2020-12-01 [1] CRAN (R 4.0.3)
jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.0.3)
labeling 0.4.2 2020-10-20 [1] CRAN (R 4.0.3)
lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.2)
lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.3)
loo 2.4.1 2020-12-09 [1] CRAN (R 4.0.3)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.3)
MASS 7.3-51.6 2020-04-26 [2] CRAN (R 4.0.2)
Matrix 1.2-18 2019-11-27 [2] CRAN (R 4.0.2)
matrixStats 0.57.0 2020-09-25 [1] CRAN (R 4.0.3)
mgcv 1.8-31 2019-11-09 [2] CRAN (R 4.0.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.3)
nlme 3.1-148 2020-05-24 [2] CRAN (R 4.0.2)
pillar 1.4.7 2020-11-20 [1] CRAN (R 4.0.3)
pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.0.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.3)
pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.3)
praise 1.0.0 2015-08-11 [1] CRAN (R 4.0.3)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.3)
processx 3.4.5 2020-11-30 [1] CRAN (R 4.0.3)
ps 1.5.0 2020-12-05 [1] CRAN (R 4.0.3)
R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.3)
RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.3)
Rcpp * 1.0.5 2020-07-06 [1] CRAN (R 4.0.3)
RcppEigen 0.3.3.9.1 2020-12-17 [1] CRAN (R 4.0.3)
RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 4.0.2)
rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.0.3)
rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.3)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.3)
rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.0.3)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.3)
scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.3)
StanHeaders * 2.21.0-7 2020-12-17 [1] CRAN (R 4.0.3)
testthat 3.0.1 2020-12-17 [1] CRAN (R 4.0.3)
tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.3)
utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.3)
V8 3.4.0 2020-11-04 [1] CRAN (R 4.0.3)
vctrs 0.3.6 2020-12-17 [1] CRAN (R 4.0.3)
viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.3)
waldo 0.2.3 2020-11-09 [1] CRAN (R 4.0.3)
withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2)
[1] C:/SLAFolder/R
[2] C:/Program Files/R/R-4.0.2/library
My Operating System is Windows 10 Education.
Any advice would be really helpful. I can run models with brms and rstan on my other windows machine, but this machine is much more powerful, and I need to utilise its cores to speed up the models.
Thanks very much for any help!