# Mingw32-make build "Could not find files for the given pattern(s)."

**URL:** <https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167>\
**Category:** Interfaces\
**Created:** [October 18, 2022, 1:50pm UTC](https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167 "2022-10-18T13:50:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_F](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@Jan\_F](https://discourse.mc-stan.org/u/Jan_F)\
**Post date:** [October 18, 2022, 1:50pm UTC](https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167/1 "2022-10-18T13:50:09Z")

</div>

R version 4.2.1 (2022-06-23 ucrt)  
Platform: x86\_64-w64-mingw32/x64 (64-bit)  
Running under: Windows 10 x64 (build 19044)

I’m trying to install stan following the [instructions here](https://mc-stan.org/docs/2_29/cmdstan-guide/cmdstan-installation.html).

I downloaded the [RTools42 installer](https://cran.r-project.org/bin/windows/Rtools/rtools42/files/rtools42-5355-5357.exe) and ran it.  
(At some point I also tried RTools40, but it didn’t work for me, so uninstalled it again.)

I added C:\rtools42\usr\bin to PATH, but found that c++.exe and g++.exe were located in C:\rtools42\x86\_64-w64-mingw32.static.posix\bin , so I added this to PATH as well. My PATH is now pretty crowded:

Sys.getenv(“PATH”)  
[1] “C:\rtools42/x86\_64-w64-mingw32.static.posix/bin;C:\rtools42/usr/bin;\usr\bin;\usr\bin;C:\Program Files\R\R-4.2.1\bin\x64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Calibre2\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Users\janfl\AppData\Local\activestate\cache\bin;C:\Users\janfl\AppData\Local\ActiveState\StateTool\release\bin;C:\Users\janfl\AppData\Local\Microsoft\WindowsApps;C:\texlive\2021\bin\win32;C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.1\bin;;C:\Users\janfl\AppData\Local\Programs\Microsoft VS Code\bin;C:\rtools42\x86\_64-w64-mingw32.static.posix\bin;C:\rtools42\usr\bin;C:\rtools42;C:\MinGW\bin;;C:/Program Files/RStudio/resources/app/bin/quarto/bin”

I found that RTools42 did not contain mingw32-make.exe, so I installed MinGW from [sourceforge](https://sourceforge.net/projects/mingw/).

When I now run mingw32-make build in the command line in the cmdstan-2.30.1 folder, I get the following error message. I suppose it might be related to [this problem here](https://discourse.mc-stan.org/t/help-cmdstan-installation-problems/29090/5). Would really appreciate help.

INFO: Could not find files for the given pattern(s).  
if ! [[mingw32-make =~ mingw32]]; then   
echo “ERROR: Please use mingw32-make on Windows to build the Intel TBB library.”;   
echo “This is packaged with RTools, for example.”;   
exit 1;   
fi  
touch stan/lib/stan\_math/lib/tbb/tbb-make-check  
tbb\_root=“…/tbb\_2020.3” CXX=“g++” CC=“gcc” LDFLAGS='-Wl,-L,“C:/Users/janfl/Desktop/cmdstan-2.30.1/stan/lib/stan\_math/lib/tbb” -Wl,-rpath,“C:/Users/janfl/Desktop/cmdstan-2.30.1/stan/lib/stan\_math/lib/tbb” ’ ‘mingw32-make’ -C “stan/lib/stan\_math/lib/tbb” -r -f “C:/Users/janfl/Desktop/cmdstan-2.30.1/stan/lib/stan\_math/lib/tbb\_2020.3/build/Makefile.tbbmalloc” compiler=gcc cfg=release stdver=c++1y malloc CXXFLAGS="-Wno-unknown-warning-option -Wno-deprecated-copy -Wno-missing-attributes -Wno-class-memaccess -Wno-sized-deallocation "  
mingw32-make[1]: Entering directory ‘C:/Users/janfl/Desktop/cmdstan-2.30.1/stan/lib/stan\_math/lib/tbb’  
g++ -c -MMD -O2 -DUSE\_WINTHREAD -D\_WIN32\_WINNT=0x0502 -DMINGW\_HAS\_SECURE\_API=1 -D\_\_MSVCRT\_VERSION\_\_=0x0700 -msse -mthreads -m64 -mrtm -Wno-unknown-warning-option -Wno-deprecated-copy -Wno-missing-attributes -Wno-class-memaccess -Wno-sized-deallocation -DTBB\_SUPPRESS\_DEPRECATED\_MESSAGES=1 -fno-rtti -fno-exceptions -D\_\_TBBMALLOC\_BUILD=1 -Wno-parentheses -Wno-uninitialized -Wno-non-virtual-dtor -flifetime-dse=1 -I…/tbb\_2020.3/src -I…/tbb\_2020.3/src/rml/include -I…/tbb\_2020.3/include -I…/tbb\_2020.3/src/tbbmalloc -I…/tbb\_2020.3/src/tbbmalloc …/tbb\_2020.3/src/tbbmalloc/backend.cpp  
In file included from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\c++\stdlib.h:36,  
from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\mm\_malloc.h:27,  
from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\xmmintrin.h:34,  
from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\immintrin.h:29,  
from …/tbb\_2020.3/include/tbb/machine/gcc\_itsx.h:57,  
from …/tbb\_2020.3/include/tbb/machine/gcc\_ia32\_common.h:107,  
from …/tbb\_2020.3/include/tbb/machine/gcc\_generic.h:232,  
from …/tbb\_2020.3/include/tbb/tbb\_machine.h:197,  
from …/tbb\_2020.3/src/tbbmalloc/Synchronize.h:20,  
from …/tbb\_2020.3/src/tbbmalloc/Customize.h:29,  
from …/tbb\_2020.3/src/tbbmalloc/TypeDefinitions.h:54,  
from …/tbb\_2020.3/src/tbbmalloc/tbbmalloc\_internal.h:21,  
from …/tbb\_2020.3/src/tbbmalloc/backend.cpp:19:  
c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\c++\cstdlib:137:11: error: ‘at\_quick\_exit’ has not been declared in ‘::’  
137 | using ::at\_quick\_exit;  
| ^ ~~~~~~~~~~~~  
c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\c++\cstdlib:160:11: error: ‘quick\_exit’ has not been declared in ‘::’  
160 | using ::quick\_exit;  
| ^ ~~~~~~~~~  
In file included from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\mm\_malloc.h:27,  
from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\xmmintrin.h:34,  
from c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\immintrin.h:29,  
from …/tbb\_2020.3/include/tbb/machine/gcc\_itsx.h:57,  
from …/tbb\_2020.3/include/tbb/machine/gcc\_ia32\_common.h:107,  
from …/tbb\_2020.3/include/tbb/machine/gcc\_generic.h:232,  
from …/tbb\_2020.3/include/tbb/tbb\_machine.h:197,  
from …/tbb\_2020.3/src/tbbmalloc/Synchronize.h:20,  
from …/tbb\_2020.3/src/tbbmalloc/Customize.h:29,  
from …/tbb\_2020.3/src/tbbmalloc/TypeDefinitions.h:54,  
from …/tbb\_2020.3/src/tbbmalloc/tbbmalloc\_internal.h:21,  
from …/tbb\_2020.3/src/tbbmalloc/backend.cpp:19:  
c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\c++\stdlib.h:43:14: error: ‘at\_quick\_exit’ has not been declared in ‘std’  
43 | using std::at\_quick\_exit;  
| ^ ~~~~~~~~~~~~  
c:\rtools42\x86\_64-w64-mingw32.static.posix\lib\gcc\x86\_64-w64-mingw32.static.posix\10.4.0\include\c++\stdlib.h:46:14: error: ‘quick\_exit’ has not been declared in ‘std’  
46 | using std::quick\_exit;  
| ^ ~~~~~~~~~  
cc1plus.exe: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics  
C:/Users/janfl/Desktop/cmdstan-2.30.1/stan/lib/stan\_math/lib/tbb\_2020.3/build/Makefile.tbbmalloc:65: recipe for target ‘backend.o’ failed  
mingw32-make[1]: \*\*\* [backend.o] Error 1  
mingw32-make[1]: Leaving directory ‘C:/Users/janfl/Desktop/cmdstan-2.30.1/stan/lib/stan\_math/lib/tbb’  
stan/lib/stan\_math/make/libraries:172: recipe for target ‘stan/lib/stan\_math/lib/tbb/tbbmalloc.def’ failed  
mingw32-make: \*\*\* [stan/lib/stan\_math/lib/tbb/tbbmalloc.def] Error 2

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 18, 2022, 4:14pm UTC](https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167/2 "2022-10-18T16:14:13Z")

</div>

To use RTools42 with cmdstan you need to create a `make/local` file in your cmdstan directory and add the entries:

```nohighlight
CXXFLAGS += -Wno-nonnull
 TBB_CXXFLAGS= -U __MSVCRT_VERSION__ -D __MSVCRT_VERSION__ =0x0E00

```

---

<div class="post-metadata">

**Author:** ![Jan\_F](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@Jan\_F](https://discourse.mc-stan.org/u/Jan_F)\
**Post date:** [October 18, 2022, 4:45pm UTC](https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167/3 "2022-10-18T16:45:18Z")

</div>

Thank you for your help.

I did this and it changed the effect of ‘mingw32-make build’.

After the compilation (a few minutes) I was asked to add ‘\cmdstan-2.30.1\stan\lib\stan\_math\lib\tbb’ (with forwardslash instead of backslash, which I adjusted) to PATH.

After doing this, I tried: ‘mingw32-make examples/bernoulli/bernoulli.exe’ as indicated [here](https://mc-stan.org/docs/2_29/cmdstan-guide/cmdstan-installation.html#checking-the-stan-compiler) in cmdstan-2.30.1 and got the following error:

g++ -Wno-nonnull -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\_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson\_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan\_math/ -I stan/lib/stan\_math/lib/eigen\_3.3.9 -I stan/lib/stan\_math/lib/boost\_1.78.0 -I stan/lib/stan\_math/lib/sundials\_6.1.1/include -I stan/lib/stan\_math/lib/sundials\_6.1.1/src/sundials -D\_USE\_MATH\_DEFINES -DBOOST\_DISABLE\_ASSERTS -c -MT stan/src/stan/model/model\_header.hpp.gch -MT stan/src/stan/model/model\_header.d -M -E -MG -MP -MF stan/src/stan/model/model\_header.d stan/src/stan/model/model\_header.hpp  
g++ -Wno-nonnull -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\_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson\_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan\_math/ -I stan/lib/stan\_math/lib/eigen\_3.3.9 -I stan/lib/stan\_math/lib/boost\_1.78.0 -I stan/lib/stan\_math/lib/sundials\_6.1.1/include -I stan/lib/stan\_math/lib/sundials\_6.1.1/src/sundials -D\_USE\_MATH\_DEFINES -DBOOST\_DISABLE\_ASSERTS -c -MT src/cmdstan/main.o -M -E -MG -MP -MF src/cmdstan/main.d src/cmdstan/main.cpp

— Translating Stan model to C++ code —  
bin/stanc.exe --o=examples/bernoulli/bernoulli.hpp examples/bernoulli/bernoulli.stan

— Compiling, linking C++ code —  
g++ -Wno-nonnull -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\_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson\_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan\_math/ -I stan/lib/stan\_math/lib/eigen\_3.3.9 -I stan/lib/stan\_math/lib/boost\_1.78.0 -I stan/lib/stan\_math/lib/sundials\_6.1.1/include -I stan/lib/stan\_math/lib/sundials\_6.1.1/src/sundials -D\_USE\_MATH\_DEFINES -DBOOST\_DISABLE\_ASSERTS -c -Wno-ignored-attributes -x c++ -o examples/bernoulli/bernoulli.o examples/bernoulli/bernoulli.hpp

make/program:56: recipe for target ‘examples/bernoulli/bernoulli.exe’ failed  
mingw32-make: \*\*\* [examples/bernoulli/bernoulli.exe] Error 1

I looked around and also did not find bernoulli.exe in the bernoulli folder. Would you be so kind as to help me with this problem, too?

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 19, 2022, 2:45pm UTC](https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167/4 "2022-10-19T14:45:09Z")

</div>

I can’t see any other errors in there. Can you clean and rebuild cmdstan and then try again?

```nohighlight
mingw32-make clean
mingw32-make build

```

---

<div class="post-metadata">

**Author:** ![Jan\_F](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@Jan\_F](https://discourse.mc-stan.org/u/Jan_F)\
**Post date:** [October 19, 2022, 5:32pm UTC](https://discourse.mc-stan.org/t/mingw32-make-build-could-not-find-files-for-the-given-pattern-s/29167/5 "2022-10-19T17:32:52Z")

</div>

I’m absolutely new to stan (and much of what I needed to do to get it installed), but I think it worked.  
Now I can focus on the conceptual aspects again. Thank you so much!
