Closed mcuee closed 1 year ago
BTW, there is no issue with avrdude msvc CMake related files. I just built avrdude using VS2022 from the source using the instructions mentioned in the Wiki and the binary is okay. Ref: https://github.com/avrdudes/avrdude/wiki/Building-AVRDUDE-for-Windows-using-Visual-Studio
So somehow the github action build is the problem.
Reference: CMake configure output from my VS2022 build
1> CMake generation started for configuration: 'x64'.
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="C:\work\avr\avrdude\out\install\x64" -DUSE_EXTERNAL:BOOL="True" -DBUILD_SHARED_LIBS:BOOL="False" -DHAVE_LIBELF:FILEPATH="" -DHAVE_LIBUSB_1_0:FILEPATH="" -DDEBUG_CMAKE:BOOL="True" -DCMAKE_VERBOSE_MAKEFILE:BOOL="True" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\work\avr\avrdude" 2>&1"
1> Working directory: C:\work\avr\avrdude\out\build\x64
1> [CMake] -- Fetching external libraries, please wait...
1> [CMake] -- Using external library 'libelf'
1> [CMake] -- Using external library 'libusb'
1> [CMake] -- Using external library 'libhidapi'
1> [CMake] -- Using external library 'libftdi'
1> [CMake] -- Configuration summary:
1> [CMake] -- ----------------------
1> [CMake] -- CMAKE_HOST_SYSTEM: Windows-10.0.22000
1> [CMake] -- CMAKE_SYSTEM: Windows-10.0.22000
1> [CMake] -- CMAKE_FIND_ROOT_PATH:
1> [CMake] -- CMAKE_C_COMPILER: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe
1> [CMake] -- CONFIG_DIR: C:/work/avr/avrdude/out/install/x64/etc
1> [CMake] -- AVRDUDE_FULL_VERSION: 7.0-20220619 (1aa59aa)
1> [CMake] -- USE_EXTERNAL: True
1> [CMake] -- USE_LIBUSBWIN32: OFF
1> [CMake] -- HAVE_LIBELF: 1
1> [CMake] -- HAVE_LIBUSB: 1
1> [CMake] -- HAVE_LIBUSB_1_0:
1> [CMake] -- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
1> [CMake] -- HAVE_LIBHID: C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/um/x64/hid.lib
1> [CMake] -- HAVE_LIBHIDAPI: 1
1> [CMake] -- HAVE_LIBFTDI: 1
1> [CMake] -- HAVE_LIBFTDI1: HAVE_LIBFTDI1-NOTFOUND
1> [CMake] -- HAVE_LIBREADLINE: HAVE_LIBREADLINE-NOTFOUND
1> [CMake] -- HAVE_LIBELF_H: 1
1> [CMake] -- HAVE_LIBELF_LIBELF_H:
1> [CMake] -- HAVE_USB_H:
1> [CMake] -- HAVE_LUSB0_USB_H: 1
1> [CMake] -- HAVE_LIBUSB_H:
1> [CMake] -- HAVE_LIBUSB_1_0_LIBUSB_H:
1> [CMake] -- HAVE_HIDAPI_HIDAPI_H: 1
1> [CMake] -- LIBUSB_COMPAT_DIR:
1> [CMake] -- ----------------------
1> [CMake] -- DO HAVE libelf
1> [CMake] -- DO HAVE libusb
1> [CMake] -- DON'T HAVE libusb_1_0
1> [CMake] -- DO HAVE libhidapi
1> [CMake] -- DO HAVE libftdi
1> [CMake] -- DON'T HAVE libftdi1
1> [CMake] -- DISABLED doc
1> [CMake] -- DISABLED parport
1> [CMake] -- DISABLED linuxgpio
1> [CMake] -- DISABLED linuxspi
1> [CMake] -- ----------------------
1> [CMake] -- Configuring done
1> [CMake] -- Generating done
1> [CMake] -- Build files have been written to: C:/work/avr/avrdude/out/build/x64
1> Extracted CMake variables.
1> Extracted source files and headers.
1> Extracted code model.
1> Extracted toolchain configurations.
1> Extracted includes paths.
1> CMake generation finished.
If I looked at github action MSVC build, somehow it does not detect libhid.
Ref: https://github.com/avrdudes/avrdude/runs/7188141729?check_suite_focus=true#step:4:43
-- USE_EXTERNAL: 1
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: 1
-- HAVE_LIBUSB: 1
-- HAVE_LIBUSB_1_0: HAVE_LIBUSB_1_0-NOTFOUND
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: HAVE_LIBHID-NOTFOUND
-- HAVE_LIBHIDAPI: 1
-- HAVE_LIBFTDI: 1
-- HAVE_LIBFTDI1: HAVE_LIBFTDI1-NOTFOUND
-- HAVE_LIBREADLINE: HAVE_LIBREADLINE-NOTFOUND
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H:
-- HAVE_USB_H:
-- HAVE_LUSB0_USB_H: 1
-- HAVE_LIBUSB_H:
-- HAVE_LIBUSB_1_0_LIBUSB_H:
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR:
No idea why this happens, maybe it has something to do with the CI environment.
In the end, probably the following is the ultimate fix.
This may be related to the Windows SDK version used in github action. As of now, this is used.
https://github.com/avrdudes/avrdude/blob/main/.github/workflows/build.yml#L214
-D CMAKE_SYSTEM_VERSION=11
I am thinking that github actions like the following may help. https://github.com/fbactions/setup-winsdk https://github.com/GuillaumeFalourd/setup-windows10-sdk-action
Ref: or maybe we can just change that to a supported version. I will try this as well. https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md#installed-windows-sdks
Unfortunately, the above two methods do not help at all. 1) https://github.com/mcuee/avrdude/actions/runs/3805885737/jobs/6474243087 2) https://github.com/mcuee/avrdude/actions/runs/3805956125/jobs/6474334190
Then it failed to build if I hard code the libhid path. The linking step failed. https://github.com/mcuee/avrdude/actions/runs/3806167734
Somehow the official avrdude-7.0 Windows binary release and the github action Windows MSVC build do not work with PICKit 2.
MSYS2 build has no issues.