Download and install MSYS2 (64‑bit). After installation, launch UCRT64 shell from the Start menu (e.g., MSYS2 UCRT64). Then update and install toolchain + libraries:
# Update package databases and core system
pacman -Syu
# if shell closes, reopen UCRT64 and run:
pacman -Su
# Install compilers, make, git, and required libraries
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain git
pacman -S mingw-w64-ucrt-x86_64-libmosquitto
pacman -S mingw-w64-ucrt-x86_64-nlohmann-json
pacman -S mingw-w64-ucrt-x86_64-openssl
# optional but recommended for serial/UART support
pacman -S mingw-w64-ucrt-x86_64-libserialport
/ucrt64/bin/.... This produces pure Windows binaries without msys‑2.0.dll dependencies.
cd /d/workspace # or any preferred folder
git clone https://github.com/g4klx/MMDVMHost.git
git clone https://github.com/g4klx/DMRGateway.git
Both projects originally target Linux. Two edits are mandatory on Windows:
-lutil (not available on Windows).-lws2_32 -liphlpapi to resolve sendto, WSAPoll, WSAStartup etc.You can apply the changes manually or with sed. Below are the exact commands for each project.
cd /d/workspace/MMDVMHost
# Remove -lutil and add required Winsock libraries
sed -i 's/-lutil //' Makefile
sed -i 's/LIBS = -lpthread -lmosquitto/LIBS = -lpthread -lmosquitto -lws2_32 -liphlpapi/' Makefile
# (Optional) remove -MD flag to avoid clang++ warnings – but not mandatory
# sed -i 's/-MD //' Makefile
cd /d/workspace/DMRGateway
sed -i 's/-lutil //' Makefile
sed -i 's/LIBS = -lpthread -lmosquitto/LIBS = -lpthread -lmosquitto -lws2_32 -liphlpapi/' Makefile
LIBS line originally contained extra flags like -lssl -lcrypto, keep them. Only replace the core part. The sed above works for the standard MMDVMHost/DMRGateway Makefiles.
# Build MMDVMHost
cd /d/workspace/MMDVMHost
make clean
make -j$(nproc)
# Build DMRGateway
cd /d/workspace/DMRGateway
make clean
make -j$(nproc)
After a successful build you will see MMDVMHost.exe and DMRGateway.exe in their respective folders.
The executables depend on a few DLLs from /ucrt64/bin/. To run them outside the MSYS2 environment (PowerShell, CMD, or another PC), copy these DLLs into the same directory as the .exe.
cd /d/workspace/MMDVMHost
ldd MMDVMHost.exe | grep -E "ucrt64|mingw"
Typical list (copy all of them):
| DLL | Purpose |
|---|---|
libgcc_s_seh-1.dll | GCC runtime (exception handling) |
libstdc++-6.dll | C++ standard library |
libwinpthread-1.dll | POSIX threads for Windows |
libmosquitto.dll | MQTT client (if used) |
libssl-3-x64.dll / libcrypto-3-x64.dll | OpenSSL (for secure connections) |
# For MMDVMHost
cd /d/workspace/MMDVMHost
cp /ucrt64/bin/libgcc_s_seh-1.dll .
cp /ucrt64/bin/libstdc++-6.dll .
cp /ucrt64/bin/libwinpthread-1.dll .
cp /ucrt64/bin/libmosquitto.dll .
cp /ucrt64/bin/libssl-3-x64.dll .
cp /ucrt64/bin/libcrypto-3-x64.dll .
# Repeat for DMRGateway
cd /d/workspace/DMRGateway
cp /ucrt64/bin/libgcc_s_seh-1.dll .
cp /ucrt64/bin/libstdc++-6.dll .
cp /ucrt64/bin/libwinpthread-1.dll .
cp /ucrt64/bin/libmosquitto.dll .
cp /ucrt64/bin/libssl-3-x64.dll .
cp /ucrt64/bin/libcrypto-3-x64.dll .
libsamplerate), add them too. Check ldd yourprogram.exe for any missing found => not found.
Now you can close the MSYS2 console and use the native Windows environment.
.\MMDVMHost.exe (or .\DMRGateway.exe)..exe..ini file (e.g., MMDVMHost.ini). Pass it as argument:.\MMDVMHost.exe MMDVMHost.iniYou can also create a simple run_mmdvm.bat script:
@echo off
cd /d D:\workspace\MMDVMHost
MMDVMHost.exe MMDVMHost.ini
pause
If you prefer a single .exe without external DLLs, add -static to LDFLAGS in the Makefile:
LDFLAGS = -g -static -L/usr/local/lib
Then make clean && make. The resulting binary will be larger (5–15 MB) but fully standalone.
| Error | Solution |
|---|---|
undefined reference to `__imp_sendto`__imp_WSAStartup | Add -lws2_32 -liphlpapi to LIBS in Makefile. |
cannot find -lutil | Remove -lutil from LIBS (not present on Windows). |
nlohmann/json.hpp: No such file | Install mingw-w64-ucrt-x86_64-nlohmann-json |
mosquitto.h: No such file | Install mingw-w64-ucrt-x86_64-libmosquitto |
libgcc_s_seh-1.dll is missing when running on another PC | Copy the DLLs listed in step 5 to the same folder as exe. |
After following the steps, both applications will run smoothly on any Windows 10/11 system (64‑bit). You can even copy the whole folder (exe + DLLs + config) to another machine without installing MSYS2.
MMDVM_Framework based software.