New Windows build instructions?
I recently spent about a full day trying to build Flashrom on Windows! I initially attempted to follow the instructions on the wiki, but they work neither for the latest stable release (1.2) nor the latest commit (ff4c624) – instead yielding errors like Checking for libpci headers... not found. and Checking for libusb-1.0 headers... not found.. The instructions allude to using MSYS2 rather than the ancient version of MinGW recommended, but doesn't specify instructions on how.
Eventually, I managed to build Flashrom 1.2 via MSYS2 by doing the following:
- Install MSYS2.
- Run the “MSYS2 MinGW x64” shell.
- Run
pacman -Syuto update packages. - Run
pacman -S binutils. -
MSYS2 has a Flashrom package now, so run
wget https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-flashrom/PKGBUILD. - Run
makepkg-mingw -sCLf. - Manually copy
libusb-1.0.dll,libftdi1.dll, andlibwinpthread-1.dllfrom/mingw64/bininto the build directorypkg/mingw-w64-x86_64-flashrom/mingw64/bin/flashrom.exeand deletelibflashrom-1.dll. - The build directory
pkg/mingw-w64-x86_64-flashrom/mingw64/bin/now containsflashrom.exeand everything needed to run it on Windows.
This was a bit of an involved process, and I'm not sure manually copying DLLs is the best way to do things, so I wouldn't be comfortable saying these are the build instructions to recommend, but… either way, I think Flashrom needs new build instructions for Windows!
I just started with a fresh install of MSYS2. The easiest way seems to be: pacman -S pactoys pacboy -S flashrom
pacboy is just a wrapper that avoids having to specify i686, x86_64, etc. architectures. If you need to see the full package names you can run: pacman -Ss flashrom
flashrom then seemed to run with no problems on my system.
@mightymos Oh, that's lovely! I suppose it still requires manually copying the DLLs if you intend to use the program outside of MSYS2, though – is that correct?
@mightymos Oh, that's lovely! I suppose it still requires manually copying the DLLs if you intend to use the program outside of MSYS2, though – is that correct?
I think you'd need: libftdi1.dll libusb-1.0.dll libwinpthread-1.dll
Yep, alright, so step #7 is still relevant.
For the record, this is one way to build the current snapshot on Windows (using MSys2 MinGW64 shell):
pacman -Syu
pacman -S base-devel binutils git pactoys
pacboy -S cc libusb meson pkg-config
git clone https://github.com/flashrom/flashrom.git
cd flashrom && meson setup \
--auto-features=enabled --buildtype=plain \
-Ddefault_programmer_name=ch341a_spi \
-Dprogrammer=ch341a_spi,dummy -Dtests=disabled \
--default-library=static --prefer-static \
--prefix="${MINGW_PREFIX}" --wrap-mode=nodownload \
build
cd build && meson compile
I'm only using flashrom with the CH341A, hence the settings. Adjust to your needs as you see fit. libwinpthread-1.dll is the only run-time dependency when built this way. Also, cc can probably be replaced with some more specific package.
try SNANDer?