New to STAN, need help on build math in Windows?

Hello guys, I’m new to the stan library. Just wondering what’s the recommended compiler for Windows ? After some googling msvc seems not an option.
I followed the recommendation on github repo, added make/local with CXX=clang++, but it didn’t work neither. Any suggestion at this point ?
the error msg is here. I was using LLVM-12.0.0-win64.

Many thanks.

We recommend using the GCC toolchain provided in RTools4: Using Rtools40 on Windows

thanks for the quick feedback.
Following the instruction, I downloaded the rtool. And using the mingw64.exe cmd line window in rtool40 folder, I tried to build the example again. I got following error.

It seems that I need to use mingw32-make instead of the default make. Any suggestion how to do that ?


mingw32-make is provided by rtools4, so the first step is to remove the existing objects compiled under the regular make via:

cd /path/to/math

mingw32-make clean-all

Next, build the files as usual, just using mingw32-make:

cd /path/to/foo

mingw32-make -j4 -f /path/to/stan-math/make/standalone math-libs

mingw32-make -f /path/to/stan-math/make/standalone foo

Thanks again. it seems that mingw32-make is not included by default in rtool40 anymore. So I did
pacman -Syu mingw-w64-x86_64-make
And following your instruction, I did

  1. mingw32-make clean-all
  2. mingw32-make -j4 -f /path/to/stan-math/make/standalone math-libs
    this time I did get a different error msg

Hmm not too sure. @wds15 could this be something to do with the changes in the TBB version?

Sorry, but this does not ring any bell with me.

This seems to be that you are trying to compile inside the Rtools terminal. We are not supporting that as that is some sort of a virtual environment.

What you need to have is have the following two folders in your PATH environment variable:


and then just compile/build inside the Windows native Powershell or even command line, though I would recommend the former.

1 Like

Appreciated the help here.
But using the powershell give me the same error msg.

Actually, I must have done something wrong. after restart my PC, it’s working now. Many Thanks guys.