Problem running rstan with R 4.0.2

I have tried installing CmdStanR and ran into a problem while following the instructions in this link.

I added

C:\Program Files\rtools40\usr\bin
C:\Program Files\rtools40\mingw64

to the PATH and tried running

pacman -Sy mingw-w64-x86_64-make

in rtools bash.

I get errors saying (if I translate again)
“the update of mingw32 failed (locking of the data base is impossible)”
then the same error for mingw64.
and the 3rd error says “Synchronisation of all data bases failed”

Could this have something to do with the space in “Program Files”? My French mashine called it “Programmes” in the file explorer and replaces that name with “Program Files” when I copy the full path.

The installation of CmdStanR failed at the install_cmdstan() level when following the “Getting started” instructions (but library(cmdstanr) worked).
Here is the error message:

> install_cmdstan(cores = 2,overwrite=T)
* Latest CmdStan release is v2.24.0
* Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
* Downloading cmdstan-2.24.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
* Download complete
* Unpacking archive...
* Building CmdStan binaries...
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
  Command 'mingw32-make.exe' not found @win/processx.c:994 (processx_exec)
Type .Last.error.trace to see where the error occured

Thanks for any tips you can give me, I appreciate it because I’m totally inexperienced with this.

@rok_cesnovar Any ideas about this CmdStanR windows problem?

Can you run

pacman -Syu mingw-w64-x86_64-make

notice the added u

2 Likes

If that fails try running RTools bash as administrator.

This is the relevant issue: https://github.com/msys2/MSYS2-packages/issues/1298

1 Like

Hi,
Thanks for your help.

I ran

pacman -Syu mingw-w64-x86_64-make

as admin and things have been downloaded and installed without error, it seems.

However, when checking “g++ --version” and “mingw32 --version” in a terminal (as admin and non-admin), it tells me the command is not recognised, so I don’t know if it worked or not. “bash --version” works.

After that, I opened RStudio and re-ran the CmdStanR installation to try it out and I still have the error:

    >install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
    Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
    (as ‘lib’ is unspecified)

      There is a binary version available but the source version is later:
                 binary source needs_compilation
    cmdstanr 0.0.0.9008  0.1.1             FALSE

    installing the source package ‘cmdstanr’

    essai de l'URL 'https://mc-stan.org/r-packages/src/contrib/cmdstanr_0.1.1.tar.gz'
    Content type 'application/gzip' length 268716 bytes (262 KB)
    downloaded 262 KB

    * installing *source* package 'cmdstanr' ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
      converting help for package 'cmdstanr'
        finding HTML links ... fini
        CmdStanGQ                               html  
        CmdStanMCMC                             html  
        CmdStanMLE                              html  
        CmdStanModel                            html  
        CmdStanVB                               html  
        cmdstan_default_install_path            html  
        cmdstan_default_path                    html  
        cmdstan_model                           html  
        cmdstanr-package                        html  
        cmdstanr_example                        html  
        eng_cmdstan                             html  
        fit-method-cmdstan_summary              html  
        fit-method-draws                        html  
        fit-method-init                         html  
        fit-method-inv_metric                   html  
        fit-method-lp                           html  
        fit-method-metadata                     html  
        fit-method-mle                          html  
        fit-method-output                       html  
        fit-method-sampler_diagnostics          html  
        fit-method-save_object                  html  
        fit-method-save_output_files            html  
        fit-method-summary                      html  
        fit-method-time                         html  
        install_cmdstan                         html  
        model-method-compile                    html  
        model-method-generate-quantities        html  
        model-method-optimize                   html  
        model-method-sample                     html  
        model-method-variational                html  
        read_cmdstan_csv                        html  
        read_sample_csv                         html  
        register_knitr_engine                   html  
        set_cmdstan_path                        html  
        stan_threads                            html  
        write_stan_json                         html  
        write_stan_tempfile                     html  
    *** copying figures
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (cmdstanr)

    The downloaded source packages are in
    	‘C:\Users\Antoine\AppData\Local\Temp\Rtmpq4bD6u\downloaded_packages’
    > library(cmdstanr)
    This is cmdstanr version 0.1.1
    - Online documentation and vignettes at mc-stan.org/cmdstanr
    - CmdStan path set to: C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0
    - Use set_cmdstan_path() to change the path
    > library(posterior)
    This is posterior version 0.1.2
    > library(bayesplot)
    This is bayesplot version 1.7.2
    - Online documentation and vignettes at mc-stan.org/bayesplot
    - bayesplot theme set to bayesplot::theme_default()
       * Does _not_ affect other ggplot2 plots
       * See ?bayesplot_theme_set for details on theme setting

    Attachement du package : ‘bayesplot’

    The following object is masked from ‘package:posterior’:

        rhat

    > color_scheme_set("brightblue")
    > install_cmdstan(cores = 2)
    * Latest CmdStan release is v2.24.0
    * Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
    * Downloading cmdstan-2.24.0.tar.gz from GitHub...
    Warning message:
    An installation already exists at C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0. Please remove or rename the installation folder or set overwrite=TRUE. 
    > install_cmdstan(cores = 2,overwrite=T)
    * Latest CmdStan release is v2.24.0
    * Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
    * Downloading cmdstan-2.24.0.tar.gz from GitHub...
    * Removing the existing installation of CmdStan...
    * Download complete
    * Unpacking archive...
    * Building CmdStan binaries...
    Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
      Command 'mingw32-make.exe' not found @win/processx.c:994 (processx_exec)
    Type .Last.error.trace to see where the error occured
    > 

Ok, that seems like the path is not set. Can you check if the paths you listed above are actually where rtools is instaled.

C:\Program Files\rtools40\usr\bin
C:\Program Files\rtools40\mingw64

The default location is usually c:\rtools40\

1 Like

Yes, those paths are correct and they are what I put in PATH.
When installing rtools40, I did install it in “Program Files” because that where I have all my other stuff.
Maybe I should just reinstall it and keep all defaults?
Cheers

That should not be a problem. Just wanted to double check.

Oh, the second one should be:

C:\Program Files\rtools40\mingw64\bin

That is the location of g++.exe and mingw32-make.exe.

1 Like

Well, I feel very very stupid…

I fixed that and re-did the whole procedure and it seems to have worked up to the point when I run install_cmdstan(cores=2,overwrite=T), which now gives me a new error:

    devtools::install_github("stan-dev/cmdstanr")
    Downloading GitHub repo stan-dev/cmdstanr@HEAD
    These packages have more recent versions available.
    It is recommended to update all of them.
    Which would you like to update?

    1: All                                       
    2: CRAN packages only                        
    3: None                                      
    4: posterior (0.1.2 -> af3bfa094...) [GitHub]

    Enter one or more numbers, or an empty line to skip updates:1
    posterior (0.1.2 -> af3bfa094...) [GitHub]
    bit       (NA    -> 4.0.4       ) [CRAN]
    Installing 1 packages: bit
    Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
    (as ‘lib’ is unspecified)
    essai de l'URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/bit_4.0.4.zip'
    Content type 'application/zip' length 636521 bytes (621 KB)
    downloaded 621 KB

    package ‘bit’ successfully unpacked and MD5 sums checked

    The downloaded binary packages are in
    	C:\Users\Antoine\AppData\Local\Temp\RtmpeswAII\downloaded_packages
    Downloading GitHub repo stan-dev/posterior@HEAD
    √  checking for file 'C:\Users\Antoine\AppData\Local\Temp\RtmpeswAII\remotes128861e94ad2\stan-dev-posterior-af3bfa0/DESCRIPTION' (491ms)
    -  preparing 'posterior': (1.1s)
    √  checking DESCRIPTION meta-information ... 
    -  checking for LF line-endings in source and make files and shell scripts (623ms)
    -  checking for empty or unneeded directories
    -  building 'posterior_0.1.2.tar.gz'
       
    Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
    (as ‘lib’ is unspecified)
    * installing *source* package 'posterior' ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
      converting help for package 'posterior'
        finding HTML links ... fini
        autocorrelation                         html  
        autocovariance                          html  
        bind_draws                              html  
        dot-ess                                 html  
        dot-rhat                                html  
        draws-index                             html  
        draws                                   html  
        draws_array                             html  
        draws_df                                html  
        draws_list                              html  
        draws_matrix                            html  
        draws_summary                           html  
        ess_basic                               html  
        ess_bulk                                html  
        ess_mean                                html  
        ess_quantile                            html  
        ess_sd                                  html  
        ess_tail                                html  
        example_draws                           html  
        extract_variable                        html  
        extract_variable_matrix                 html  
        fold_draws                              html  
        mcse_mean                               html  
        mcse_quantile                           html  
        mcse_sd                                 html  
        merge_chains                            html  
        mutate_variables                        html  
        order_draws                             html  
        posterior-package                       html  
        print.draws_array                       html  
        print.draws_df                          html  
        print.draws_list                        html  
        print.draws_matrix                      html  
        quantile2                               html  
        r_scale                                 html  
        rename_variables                        html  
        repair_draws                            html  
        resample_draws                          html  
        rhat                                    html  
        rhat_basic                              html  
        split_chains                            html  
        subset_draws                            html  
        thin_draws                              html  
        u_scale                                 html  
        weight_draws                            html  
        weights.draws                           html  
        z_scale                                 html  
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (posterior)
    √  checking for file 'C:\Users\Antoine\AppData\Local\Temp\RtmpeswAII\remotes128874183c30\stan-dev-cmdstanr-39e5f96/DESCRIPTION' (358ms)
    -  preparing 'cmdstanr': (1.7s)
    √  checking DESCRIPTION meta-information ... 
    -  checking for LF line-endings in source and make files and shell scripts (570ms)
    -  checking for empty or unneeded directories
    -  building 'cmdstanr_0.1.1.tar.gz'
       
    Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
    (as ‘lib’ is unspecified)
    * installing *source* package 'cmdstanr' ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
      converting help for package 'cmdstanr'
        finding HTML links ... fini
        CmdStanGQ                               html  
        CmdStanMCMC                             html  
        CmdStanMLE                              html  
        CmdStanModel                            html  
        CmdStanVB                               html  
        cmdstan_default_install_path            html  
        cmdstan_default_path                    html  
        cmdstan_model                           html  
        cmdstanr-package                        html  
        cmdstanr_example                        html  
        eng_cmdstan                             html  
        fit-method-cmdstan_summary              html  
        fit-method-draws                        html  
        fit-method-init                         html  
        fit-method-inv_metric                   html  
        fit-method-lp                           html  
        fit-method-metadata                     html  
        fit-method-mle                          html  
        fit-method-output                       html  
        fit-method-sampler_diagnostics          html  
        fit-method-save_object                  html  
        fit-method-save_output_files            html  
        fit-method-summary                      html  
        fit-method-time                         html  
        install_cmdstan                         html  
        model-method-compile                    html  
        model-method-generate-quantities        html  
        model-method-optimize                   html  
        model-method-sample                     html  
        model-method-variational                html  
        read_cmdstan_csv                        html  
        read_sample_csv                         html  
        register_knitr_engine                   html  
        set_cmdstan_path                        html  
        stan_threads                            html  
        write_stan_json                         html  
        write_stan_tempfile                     html  
    *** copying figures
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (cmdstanr)
    > library(cmdstanr)
    This is cmdstanr version 0.1.1
    - Online documentation and vignettes at mc-stan.org/cmdstanr
    - CmdStan path set to: C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0
    - Use set_cmdstan_path() to change the path
    > library(posterior)
    This is posterior version 0.1.2
    > library(bayesplot)
    This is bayesplot version 1.7.2
    - Online documentation and vignettes at mc-stan.org/bayesplot
    - bayesplot theme set to bayesplot::theme_default()
       * Does _not_ affect other ggplot2 plots
       * See ?bayesplot_theme_set for details on theme setting

    Attachement du package : ‘bayesplot’

    The following object is masked from ‘package:posterior’:

        rhat

    > color_scheme_set("brightblue")
    > install_cmdstan(cores = 2,overwrite=T)
    * Latest CmdStan release is v2.24.0
    * Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
    * Downloading cmdstan-2.24.0.tar.gz from GitHub...
    * Removing the existing installation of CmdStan...
    * Download complete
    * Unpacking archive...
    * Building CmdStan binaries...
    Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
    cp bin/windows-stanc bin/stanc.exe
    g++ -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs -Wno-int-in-bool-context -Wno-attributes -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.7 -I stan/lib/stan_math/lib/boost_1.72.0 -I stan/lib/stan_math/lib/sundials_5.2.0/include  -D_USE_MATH_DEFINES  -DBOOST_DISABLE_ASSERTS      -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp
    cd stan/lib/stan_math/lib/boost_1.72.0; ./bootstrap.bat gcc
    Building Boost.Build engine
    g++ -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs -Wno-int-in-bool-context -Wno-attributes -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.7 -I stan/lib/stan_math/lib/boost_1.72.0 -I stan/lib/stan_math/lib/sundials_5.2.0/include  -D_USE_MATH_DEFINES  -DBOOST_DISABLE_ASSERTS      -c -fvisibility=hidden -o bin/cmdstan/print.o src/cmdstan/print.cpp
    C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
    C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
    collect2.exe: error: ld returned 1 exit status
    Fichier introuvable

    Failed to build Boost.Build engine.
    Please consult bootstrap.log for further diagnostics.

    mingw32-make.exe: *** [make/command:35: stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a] Error 1
    mingw32-make.exe: *** Waiting for unfinished jobs....

    Warning message:
    There was a problem during installation. See the error message(s) above. 

You can ignore that one. Still getting to the bottom as to why it occasionally occurs on some Windows installs. I think you may have another compiler in PATH and that does not play well.

Anyhow, just try.

library(cmdstanr)

file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file)
data_list <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1))

fit <- mod$sample(
  data = data_list,
  seed = 123,
  chains = 4,
  parallel_chains = 2,
  refresh = 500
)

The first compile will take some time, but then everything will work as it should.

2 Likes

I am encountering the same warning as the OP in this thread (namely “‘C:/rtools40/usr/mingw_/bin/g++’ not found”). Like the OP I don’t have a directory called C:/rtools40/usr/mingw_/bin (although I do have C:\rtools40\mingw64\bin). However, I notice that https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started says:

On Windows you may get a warning about g++ not being found but this appears to be harmless.

I assume this refers to the warning we are getting. Is that right?

In my case it does seem to be harmless, although I have not kept timings, and therefore I don’t know whether it has affected compilation times, or sampling times.

Update: The combined thread on these kinds of issues has the definitive reply (I think) to this warning: Rstan on Windows

It is harmless unless you have #include statements in your Stan program.

1 Like

I ran this code and I get these errors:

> file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
> mod <- cmdstan_model(file)
Compiling Stan program...
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_nvecserial.a
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_cvodes.a
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_idas.a
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_kinsol.a
C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb_2019_U8/build/Makefile.tbb:28: CONFIG: cfg=release arch=intel64 compiler=gcc target=windows runtime=mingw8.3.0
task.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
arena.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
scheduler.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe: *** [make/program:62: C:/Users/Antoine/AppData/Local/Temp/RtmpstbwaD/model-21a02d866116.exe] Error 1
Erreur : An error occured during compilation! See the message above for more information.

If it says “cannot find C:/Program: No such file in directory”, isn’t that an indication that the space in “Program Files” causes problems?

Concerning the “g++” warning message when running stan(), I confirm that it does not seem to prevent anything, I was able to run multiple (simple) models without issues.

Cheers

Can you run the following:

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

and restart R or Rstudio and then run:

rebuild_cmdstan(cores = 4)
1 Like

It’s an awful lot of lines that I can’t all paste here, so I’m only pasting the first part and chunks with red messages:

library(cmdstanr)
This is cmdstanr version 0.1.1
- Online documentation and vignettes at mc-stan.org/cmdstanr
- CmdStan path set to: C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0
- Use set_cmdstan_path() to change the path
> rebuild_cmdstan(cores = 4)
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
rm -f -r test
rm -f 
rm -f 
rm -f 
rm -f 
  removing dependency files
rm -f src/cmdstan/main.d   stan//src/stan/model/model_header.d
rm -f   
rm -f   
  cleaning sundials targets
rm -f stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_kinsol.a stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodea.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodea_io.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_bandpre.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_bbdpre.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_diag.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_direct.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_io.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_ls.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_nls.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_nls_sim.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_nls_stg.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_nls_stg1.o stan/lib/stan_math/lib/sundials_5.2.0/src/cvodes/cvodes_spils.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idaa.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idaa_io.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_bbdpre.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_direct.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_ic.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_io.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_ls.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_nls.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_nls_sim.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_nls_stg.o stan/lib/stan_math/lib/sundials_5.2.0/src/idas/idas_spils.o stan/lib/stan_math/lib/sundials_5.2.0/src/kinsol/kinsol.o stan/lib/stan_math/lib/sundials_5.2.0/src/kinsol/kinsol_bbdpre.o stan/lib/stan_math/lib/sundials_5.2.0/src/kinsol/kinsol_direct.o stan/lib/stan_math/lib/sundials_5.2.0/src/kinsol/kinsol_io.o stan/lib/stan_math/lib/sundials_5.2.0/src/kinsol/kinsol_ls.o stan/lib/stan_math/lib/sundials_5.2.0/src/kinsol/kinsol_spils.o stan/lib/stan_math/lib/sundials_5.2.0/src/nvector/serial/nvector_serial.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_band.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_dense.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_direct.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_futils.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_iterative.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_linearsolver.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_math.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_matrix.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_nonlinearsolver.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_nvector.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_nvector_senswrapper.o stan/lib/stan_math/lib/sundials_5.2.0/src/sundials/sundials_version.o stan/lib/stan_math/lib/sundials_5.2.0/src/sunlinsol/band/sunlinsol_band.o stan/lib/stan_math/lib/sundials_5.2.0/src/sunlinsol/dense/sunlinsol_dense.o stan/lib/stan_math/lib/sundials_5.2.0/src/sunmatrix/band/sunmatrix_band.o stan/lib/stan_math/lib/sundials_5.2.0/src/sunmatrix/dense/sunmatrix_dense.o stan/lib/stan_math/lib/sundials_5.2.0/src/sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.o stan/lib/stan_math/lib/sundials_5.2.0/src/sunnonlinsol/newton/sunnonlinsol_newton.o
  cleaning Intel TBB targets
rm -f -rf stan/lib/stan_math/lib/tbb
rm -f bin/stanc.exe bin/stanc2.exe bin/stansummary.exe bin/print.exe bin/diagnose.exe
rm -f -r src/cmdstan/main*.o bin/cmdstan
rm -f stan/src/stan/model/model_header.hpp.gch
rm -f examples/bernoulli/bernoulli.exe examples/bernoulli/bernoulli.o examples/bernoulli/bernoulli.d examples/bernoulli/bernoulli.hpp
rm -f -r stan/lib/stan_math/lib/boost_1.72.0/stage/lib stan/lib/stan_math/lib/boost_1.72.0/bootstrap.log
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
cp bin/windows-stanc bin/stanc.exe
cd stan/lib/stan_math/lib/boost_1.72.0; ./bootstrap.bat gcc
.
.
.

g++ -c -MMD -O2 -DUSE_WINTHREAD -D_WIN32_WINNT=0x0502 -DMINGW_HAS_SECURE_API=1 -D__MSVCRT_VERSION__=0x0700 -msse -mthreads -m64 -mrtm    -fno-rtti -fno-exceptions -D__TBBMALLOC_BUILD=1 -Wno-parentheses -Wno-uninitialized -Wno-non-virtual-dtor  -flifetime-dse=1 -I../tbb_2019_U8/src -I../tbb_2019_U8/src/rml/include -I../tbb_2019_U8/include -I../tbb_2019_U8/src/tbbmalloc -I../tbb_2019_U8/src/tbbmalloc -I. ../tbb_2019_U8/src/tbbmalloc/frontend.cpp
gcc  -o tbbmalloc.dll backend.o large_objects.o backref.o  tbbmalloc.o  itt_notify_malloc.o frontend.o   -lpsapi -shared -m64 -Wl,-L,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb" -Wl,--version-script,tbbmalloc.def
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
g++  -o tbbmalloc_proxy.dll proxy.o tbb_function_replacement.o   -lpsapi tbbmalloc.dll  -shared -m64 -Wl,-L,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb"
Fichier introuvable

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

mingw32-make[1]: Leaving directory 'C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb'
mingw32-make.exe: *** [make/command:35: stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a] Error 1
mingw32-make.exe: *** Waiting for unfinished jobs....
touch stan/lib/stan_math/lib/tbb/version_tbb_2019_U8
tbb_root="../tbb_2019_U8" CXX="g++" CC="gcc" LDFLAGS='-Wl,-L,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb"' mingw32-make.exe -C "stan/lib/stan_math/lib/tbb" -r -f "C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb_2019_U8/build/Makefile.tbb" compiler=gcc cfg=release stdver=c++1y
mingw32-make[1]: Entering directory 'C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb'
C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb_2019_U8/build/Makefile.tbb:28: CONFIG: cfg=release arch=intel64 compiler=gcc target=windows runtime=mingw8.3.0
g++ -o concurrent_hash_map.o -c -MMD -O2 -DUSE_WINTHREAD -D_WIN32_WINNT=0x0502 -DMINGW_HAS_SECURE_API=1 -D__MSVCRT_VERSION__=0x0700 -msse -mthreads -m64 -mrtm   -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-uninitialized -Wno-non-virtual-dtor  -std=c++1y  -I../tbb_2019_U8/src -I../tbb_2019_U8/src/rml/include -I../tbb_2019_U8/include ../tbb_2019_U8/src/tbb/concurrent_hash_map.cpp
.
.
.
task.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
arena.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
scheduler.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
mingw32-make[1]: Leaving directory 'C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb'

In line 7, it says “Information: Unable to find files for the specified models”. It has weird characters in it, but that is what I think it says.
In this chunk, “Fichier introuvable” means “Unable to find file”:

g++  -o tbbmalloc_proxy.dll proxy.o tbb_function_replacement.o   -lpsapi tbbmalloc.dll  -shared -m64 -Wl,-L,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb"
Fichier introuvable

Again, sorry for the French.

I re-ran the example model and I get the same error as before.

In this case the space in Program Files indeed the issue. Can you reinstall it to the default location and rerun this line afterwards

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

and then try again.

1 Like

Seemed to have worked smoothly!

At the end of running rebuild_cmdstan(), it says

NOTE: Please add C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb to your PATH variable.
You may call mingw32-make install-tbb to automatically update your user configuration.

I assume

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

took care of that?

@rok_cesnovar, @bgoodri, @jonah, @stevebronder Thank you all very much for your help with my relatively trivial issues, I appreciate it!
Cheers

1 Like

Not a problem at all, it was not your fault. You can ignore the above warning, this is printed on install, but cmdstanr handles that automatically.

Cheers

2 Likes

When I installed the newest rstan, I seem to have this error:

> schools_dat <- list(J = 8, 
+                     y = c(28,  8, -3,  7, -1,  1, 18, 12),
+                     sigma = c(15, 10, 16, 11,  9, 11, 10, 18))
> fit <- stan(file = 'C:\\schools.stan', data = schools_dat)
Error in withr::set_makevars(new, path, state, assignment = assignment) : 
  Multiple results for CXX14FLAGS found, something is wrong.FALSE
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  'C:/Rtools/mingw_/bin/g++' not found

There must be multiple CXX14FLAGS entries in your Makevars.win or Makevars file. What comes up if you check those files like this?

file.edit(file.path(Sys.getenv("HOME"), ".R", "Makevars.win"))
file.edit(file.path(Sys.getenv("HOME"), ".R", "Makevars"))
1 Like