This guide explains how to build SourceMinder on Windows using MSYS2, which provides a Unix-like environment with the necessary tools and libraries.
If you just need the Python indexer, follow these minimal steps:
# In MSYS2 UCRT64 terminal:
pacman -S --needed mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-sqlite3 mingw-w64-ucrt-x86_64-tree-sitter mingw-w64-ucrt-x86_64-libsystre git make
cd /c/Projects/SourceMinder # adjust path as needed
# Clone tree-sitter for headers (MSYS2 package doesn't include dev headers)
git clone --depth 1 https://github.com/tree-sitter/tree-sitter.git
# Clone the Python grammar
git clone https://github.com/tree-sitter/tree-sitter-python.git
./configure --enable-python
makeDownload and install MSYS2 from: https://www.msys2.org/
Run the installer and follow the prompts. Default installation path is C:\msys64.
Open "MSYS2 UCRT64" from the Start menu (important: use UCRT64, not MSYS or MINGW32).
Update the package database:
pacman -SyuIf prompted to close the terminal, do so and reopen "MSYS2 UCRT64", then run:
pacman -Supacman -S --needed \
mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-sqlite3 \
mingw-w64-ucrt-x86_64-tree-sitter \
mingw-w64-ucrt-x86_64-libsystre \
git \
makeIn the MSYS2 UCRT64 terminal:
cd /c/Projects/SourceMinder # adjust to your pathNote: In MSYS2, Windows paths use forward slashes and C: becomes /c/.
First, clone the main tree-sitter repository for headers (the MSYS2 package only includes the runtime library, not development headers):
git clone --depth 1 https://github.com/tree-sitter/tree-sitter.gitThen clone the grammars you need:
# For Python only:
git clone https://github.com/tree-sitter/tree-sitter-python.git
# Or for all languages:
git clone https://github.com/tree-sitter/tree-sitter-c.git
git clone https://github.com/tree-sitter/tree-sitter-go.git
git clone https://github.com/tree-sitter-perl/tree-sitter-perl.git
git clone https://github.com/tree-sitter/tree-sitter-php.git
git clone https://github.com/tree-sitter/tree-sitter-python.git
git clone https://github.com/tree-sitter/tree-sitter-typescript.git# Python only (fastest build):
./configure --enable-python
# Or all languages:
./configure --enable-all
# Or specific combinations:
./configure --enable-python --enable-cmakeThe binaries will be created in the build/ directory with symlinks in the project root.
# Index a directory
./index-c . --once --verbose
# Query the index
./qi test --limit 10Add the MSYS2 bin directory to your PATH, or use full paths:
C:\msys64\ucrt64\bin\bash.exe -c "cd /c/Projects/SourceMinder && ./qi test --limit 10"Or copy the required DLLs alongside the executables for standalone use (see "Standalone Executables" below).
To run the executables outside of MSYS2, copy the required DLLs:
# From MSYS2 UCRT64 terminal
cp /ucrt64/bin/libsqlite3-0.dll build/
cp /ucrt64/bin/libtree-sitter.dll build/
cp /ucrt64/bin/libgcc_s_seh-1.dll build/
cp /ucrt64/bin/libwinpthread-1.dll build/Then you can run from Windows Command Prompt:
cd C:\Projects\SourceMinder\build
qi.exe test --limit 10The file watcher (daemon mode) uses Windows-specific APIs when built under MSYS2. If you encounter issues with --daemon mode, use --once mode instead:
# Instead of daemon mode:
./index-c . --once --verbose
# Re-run manually when files change, or use a watch scriptEnsure you're using "MSYS2 UCRT64" terminal, not plain "MSYS2".
Install the SQLite development package:
pacman -S mingw-w64-ucrt-x86_64-sqlite3The MSYS2 tree-sitter package only includes the CLI tool, not the library or headers. Clone the main tree-sitter repository:
git clone --depth 1 https://github.com/tree-sitter/tree-sitter.gitThe configure script will find headers in tree-sitter/lib/include/ and build the library from tree-sitter/lib/src/lib.c.
Install the libsystre package which provides POSIX regex:
pacman -S mingw-w64-ucrt-x86_64-libsystreMake sure you're using the UCRT64 environment consistently. Don't mix MSYS, MINGW32, MINGW64, and UCRT64.
SourceMinder expects Unix-style paths (forward slashes). In MSYS2, Windows paths are automatically converted:
C:\Projects\SourceMinderbecomes/c/Projects/SourceMinder
| Environment | Use Case |
|---|---|
| MSYS2 UCRT64 | Recommended - Modern Windows C runtime |
| MSYS2 MINGW64 | Alternative - Older MinGW runtime |
| MSYS2 MSYS | Unix tools only - Don't use for building |
- README.md - Main documentation
- MACOS_SETUP.md - macOS build instructions