This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62A7: USB DFU mode DFU-util build by MSYS64 cannot link to libusb-1.0.dll and libwinpthread-1.dll files

Part Number: AM62A7

Sir, 

I try to build dfu-util on Windows from MSYS2.

I complete all the steps but it seems not being able to have the dll files linked. 

Is the instruction correct or any step missed or do it in wrong way?

Besides, is there a pre-build dfu-util for windows can be downloaded directly for DFU?  

https://dfu-util.sourceforge.net/build.html

Building on Windows using MinGW-w64 from MSYS2

This assumes using release tarballs or having run ./autogen.sh on the git sources.

First install MSYS2 from the MSYS2 installer home page.

To avoid interference from other software on your computer, set a clean path in the MSYS window before running the upgrade commands:

PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin

pacman -Syu
pacman -Su

Close all MSYS windows and open a new one to install the toolchain:

PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin

pacman -S mingw-w64-x86_64-gcc
pacman -S make

Now open a MINGW64 shell to build libusb and dfu-util:

PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin

cd libusb-1.0.24
./configure --prefix=$PWD/../build
make
make install
cd ..

cd dfu-util-0.11
./configure USB_CFLAGS="-I$PWD/../build/include/libusb-1.0" \
            USB_LIBS="-L $PWD/../build/lib -lusb-1.0" --prefix=$PWD/../build
make
make install
cd ..

To link libusb statically into dfu-util.exe use instead of only "make":

make LDFLAGS=-static

The built executables (and DLL) will now be in the build/bin folder.

BR, Rich