this looks like the boost library failed to build. A couple of questions before I can give more advice.
What version of R do you have and what version of RTools do you use?
This is some variation of the problem we have already seen with RTools 3.5 on Windows now that Cmdstan uses the Boost program options lib.
We already know a few solutions to your problem, but I would like to see if this is something new causing it.
The solutions we know so far are:
use R 4.0 and RTools 4.0 (this is highly recommended for Windows as you can get 40% faster compile times for free, by just setting a flag; but I understand this is not an option for everyone)
run the Boost build script manually (there are a few ways of doing this)
It might just be something else in PATH that is causing your problem here, as we know that Windows + Rtools 3.5 + Cmdstan 2.24.0 do work out of the box.
@rok_cesnovar I’m having the same error as the original post, only I’m using R 4.0.2 and rtools40. I’m able to compile packages from source with success, and got through these directions with successful checks on the installed versions — https://www.maxmantei.com/2020/05/16/cmdstanr-windows — but install_cmdstan aborts with
Sure, would like to hunt down the issues that cause this for some people as well:
Can you run cat(readLines(file.path(cmdstan_default_install_path(), "cmdstan-2.24.0", "stan","lib","stan_math","lib","boost_1.72.0","bootstrap.log")), sep = "\n")
You can actually start using cmdstanr now. The first compilation might take a minute but then everything should work as normal.
Try
test_model <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
test_data <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.data.json")
mod <- cmdstan_model(test_model)
fit <- mod$sample(data = test_data)
Please report back if it does or does not.
Three additional things would help me get to the bottom of this to if you have a minute to spare. I am unable to reproduce this on three Windows machines.
I require the output of the following three commands:
Thanks. It did work, though took some time compiling and had a series of messages:
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
ar: creating stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_nvecserial.a
ar: creating stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_cvodes.a
ar: creating stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_idas.a
ar: creating stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_kinsol.a
C:/Users/ffuchs/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
As far as those three commands go:
> list.files(file.path(cmdstan_path(), "stan","lib","stan_math","lib","boost_1.72.0", "stage", "lib"))
[1] "cmake" "libboost_program_options-mgw83-mt-x64-1_72.a"
> processx::run("g++", "--version")
$status
[1] 0
$stdout
[1] "g++ (Built by Jeroen for the R-project) 8.3.0\r\nCopyright (C) 2018 Free Software Foundation, Inc.\r\nThis is free software; see the source for copying conditions. There is NO\r\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r\n\r\n"
$stderr
[1] ""
$timeout
[1] FALSE
> Sys.getenv("PATH")
[1] "C:/Users/ffuchs/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb;C:/Users/ffuchs/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb;C:\\rtools40\\usr\\bin;C:\\Program Files\\R\\R-4.0.2\\bin\\x64;C:\\Rtools\\bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\Users\\ffuchs\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\GnuWin32\\bin;C:\\Program Files\\Java\\jre1.8.0_201\\bin;C:\\Program Files\\Java\\jre1.8.0_201\\;C:\\Program Files\\Java\\jre1.8.0_201\\lib;C:\\Program Files\\MSG MCE Software I10;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;"
Interesting. That makes a lot of sense. I can handle the PATH issues. Appreciate you taking a look at this; sorry it was idiosyncratic to my machine and not more productive.
Yes, still having this issue! I work on two machines(covid) and it worked fine on the other once I updated my Path to include RBuildTools\3.5\bin, RBuildTools\3.5\mingw_64\bin, and Git\bin.