I am having difficulty compiling Stan programs when invoking cmdstanr either through brms or when invoking direct compile using cmdstanr. The problem is due to the ming32w-make.exe hitting an internal readdir error. Of note, I can run the bernoulli example from Getting started with CmdStanR • cmdstanr but not the schools example. Below is output:
Running "g++" --version
g++ (Built by Jeroen for the R-project) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Running mingw32-make --version
GNU Make 4.2.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
The C++ toolchain required for CmdStan is setup properly!
If that fails I think the only solution might be installing R in a location without spaces. If it works, we can find a simpler workaround as opposed to manually setting PATH each time.
Thanks for replying and for your suggestion, rok_cesnovar! Unfortunately, even after manually setting the PATH, I was unable to run the schools example. If the best option is to install R to a location without any spaces in the file path, I will give it a shot and update the thread if it solves the problem.
@rok_cesnovar 's guess was the same one I had - that spaces are an issue.
Are you running this code from a network or sync’d directory? Are you running the code from a directory with spaces? Do you have any other envs configured for compilation that may conflict with any mingw stuff, like Conda envs?
If all of those are no, then my advice, honestly, is to use WSL2.
If any of those are yes, then my advice is still to use WSL2. I just find WSL2/Linux + Stan to be a much more consistent experience.
Thanks @Stephen_Martin. I was running the code from a network location, but I moved the .Rmd file to my local computer and tried again. It went a little further, but still gave me a ming32w-make error. Even so, I tried running the schools example from cmdstan from the console, and get the same error. You may be right that WSL2 is the way to go. Since using cmdstanr is not a normal part of my workflow, I’ll probably just move on. But I appreciate all the help!