<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/162879>162879</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Running the libc++ Benchmarks on Windows with MinGW
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
c8ef
</td>
</tr>
</table>
<pre>
I'm attempting to run a libc++ benchmark on Windows MinGW using the latest `mstorsjo/llvm-mingw` toolchain.
Initially, executing `./bin/llvm-lit.py a.bench` resulted in an ld.lld error:
```
ld.lld: error: undefined symbol: __declspec(dllimport) benchmark::internal::InitializeStreams()
>>> referenced by C:/Users/xxx/AppData/Local/Temp/sort_heap-a87419.o:(__cxx_global_var_init)
NOTE: a relevant symbol '_ZN9benchmark8internal17InitializeStreamsEv' is available in C:/Users/xxx/Desktop/llvm-project/build/libcxx/test/benchmarks/google-benchmark/lib/libbenchmark.a but cannot be used because it is not an import library.
```
After some searching, I added the `-DBENCHMARK_STATIC_DEFINE` flag. However, a new error occurred:
```
ld.lld: error: undefined symbol: __declspec(dllimport) SHGetValueA
>>> referenced by libbenchmark.a(sysinfo.cc.obj):(benchmark::CPUInfo::CPUInfo())
clang-21: error: linker command failed with exit code 1 (use -v to see invocation)
```
Adding `-lShlwapi` finally resolved the issue.
Since I'm not a Windows/MinGW expert, I was wondering if there's a way to make running the benchmark work out of the box.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0Vd1u4zYTfRr6ZmBBoh1bvtCFkti7xvdtWmyyXaA3xogcWUwoUiAp__TpC0p2_rboXQFBgCjO8MycM4fovdobooLd3LKb-wn2obGuEDnVk8rKc7FlfNkChkBtF5TZQ7DgegMIWlWC8VvGb6EiI5oW3QtYAz-Vkfbo4ZsyX35C74eghkBjIB-ALdLWB-v8s2V8o_WhnbbK7I9skUKwVosGlUlYWrK03BoVFGp9ZvwO6ESiHy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