Skip to content

Building AVRDUDE for Windows using MSYS2

mcuee edited this page Dec 30, 2022 · 20 revisions

If you prefer to use MSYS2 as your development environment, you may build AVRDUDE directly in MSYS2.

MSYS2 can also be used to build native Windows binaries, i.e. executables that do not require any MSYS2 DLLs to execute. If you want to create native Windows binaries, make sure that you do not use the MSYS environment. Instead, use a Windows compatible environment, such as MINGW32 or MINGW64.

The MSYS2 stock libraries, such as libusb-1.0, libusb-win32, or libftdi do not support the entire USB driver functionality, as the custom libraries of the MSVC builds do. If you have trouble connecting to your USB devices, see Troubleshooting USB devices in Windows.

Prerequisites

Update the package database first:

pacman -Syu

For 32-bit builds, use the MINGW32 environment and install

pacman -S --needed base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake
pacman -S --needed mingw-w64-i686-libelf mingw-w64-i686-libusb mingw-w64-i686-libusb-compat-git mingw-w64-i686-libusb-win32 mingw-w64-i686-hidapi mingw-w64-i686-libftdi

For 64-bit builds, use the MINGW64 environment and install

pacman -S --needed base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
pacman -S --needed mingw-w64-x86_64-libelf mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-libusb-win32 mingw-w64-x86_64-hidapi mingw-w64-x86_64-libftdi

Build Instructions

For 32-bit builds, use the MINGW32 environment and run the following commands:

git clone https://github.com/avrdudes/avrdude
cd avrdude
cmake -G"MSYS Makefiles" -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_mingw32
cmake --build build_mingw32

For 64-bit builds, use the MINGW64 environment and run the following commands:

git clone https://github.com/avrdudes/avrdude
cd avrdude
cmake -G"MSYS Makefiles" -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_mingw64
cmake --build build_mingw64

Known issues with MSYS2 mingw32/mingw64 builds: as it uses libusb-1.0 and libusb-compat-0.1, it may have some issues with devices using libusb0.sys driver. The recommendation is to use WinUSB for generic USB device and HIDAPI for USB HID device. The official avrdude Windows binary will use MSVC build and avrdude-libusb to address this issue.

Clone this wiki locally