stan-dev / stan-dev/rstan

Compalitation errors when running stan_model on Windows

Open
#936 2 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'm getting error when runnung stan_model on Wondows

Description:
library(rstan)
example(stan_model, package = "rstan", run.dontrun = TRUE)

The error message is the following:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/nmuravskaya/Documents/R/R-4.0.5/library/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'; file2bec5ef94a42.o:file2bec5ef94a42.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/nmuravskaya/Documents/R/R-4.0.5/library/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'; file2bec5ef94a42.o:fi
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  'C:/rtools40/usr/mingw_/bin/g++' not found

I did try to compile packages using all cores

Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))

install.packages(c("StanHeaders","rstan"),type="source")

And other recommendations from Stan forum also didn't work

RStan Version:

`> devtools::session_info("rstan")

  • Session info ---------------------------------------------------------------------------------------------------------------------
    setting value
    version R version 4.0.5 (2021-03-31)
    os Windows >= 8 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz America/Los_Angeles
    date 2021-05-20

  • Packages -------------------------------------------------------------------------------------------------------------------------
    package * version date lib source
    backports 1.2.1 2020-12-09 [1] CRAN (R 4.0.3)
    BH 1.75.0-0 2021-01-11 [1] CRAN (R 4.0.3)
    callr 3.7.0 2021-04-20 [1] CRAN (R 4.0.5)
    checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.2)
    cli 2.5.0 2021-04-26 [1] CRAN (R 4.0.5)
    colorspace 2.0-1 2021-05-04 [1] CRAN (R 4.0.5)
    crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.5)
    curl 4.3.1 2021-04-30 [1] CRAN (R 4.0.5)
    desc 1.3.0 2021-03-05 [1] CRAN (R 4.0.5)
    digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.5)
    ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.0.5)
    fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.5)
    farver 2.1.0 2021-02-28 [1] CRAN (R 4.0.5)
    ggplot2 * 3.3.3 2020-12-30 [1] CRAN (R 4.0.5)
    glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.5)
    gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.2)
    gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
    inline 0.3.17 2020-12-01 [1] CRAN (R 4.0.5)
    isoband 0.2.4 2021-03-03 [1] CRAN (R 4.0.5)
    jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.0.5)
    labeling 0.4.2 2020-10-20 [1] CRAN (R 4.0.3)
    lattice 0.20-44 2021-05-02 [1] CRAN (R 4.0.5)
    lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.5)
    loo 2.4.1 2020-12-09 [1] CRAN (R 4.0.5)
    magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.5)
    MASS 7.3-54 2021-05-03 [1] CRAN (R 4.0.5)
    Matrix 1.2-18 2019-11-27 [1] CRAN (R 4.0.3)
    matrixStats 0.58.0 2021-01-29 [1] CRAN (R 4.0.5)
    mgcv 1.8-35 2021-04-18 [1] CRAN (R 4.0.5)
    munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
    nlme 3.1-152 2021-02-04 [1] CRAN (R 4.0.5)
    pillar 1.6.1 2021-05-16 [1] CRAN (R 4.0.2)
    pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.0.5)
    pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
    prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
    processx 3.5.2 2021-04-30 [1] CRAN (R 4.0.5)
    ps 1.6.0 2021-02-28 [1] CRAN (R 4.0.5)
    R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.5)
    RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.0)
    Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.0.5)
    RcppEigen 0.3.3.9.1 2020-12-17 [1] CRAN (R 4.0.5)
    RcppParallel 5.1.4 2021-05-04 [1] CRAN (R 4.0.5)
    rlang 0.4.11 2021-04-30 [1] CRAN (R 4.0.5)
    rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.5)
    rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.0.2)
    scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
    StanHeaders * 2.21.0-7 2020-12-17 [1] CRAN (R 4.0.5)
    tibble 3.1.1 2021-04-18 [1] CRAN (R 4.0.5)
    utf8 1.2.1 2021-03-12 [1] CRAN (R 4.0.5)
    V8 3.4.2 2021-05-01 [1] CRAN (R 4.0.5)
    vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.0.5)
    viridisLite 0.4.0 2021-04-13 [1] CRAN (R 4.0.5)
    withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.5)

[1] C:/Users/nmuravskaya/Documents/R/R-4.0.5/library`

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

Start by reproducing the stan_model example on Windows with the reported RStan, StanHeaders, R, and Rtools versions. Inspect the reported linker error and missing g++ warning; done means the example compiles successfully without the multiple-definition or compiler-path errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.