Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Windows build instructions? #242

Open
obskyr opened this issue Feb 16, 2022 · 6 comments
Open

New Windows build instructions? #242

obskyr opened this issue Feb 16, 2022 · 6 comments

Comments

@obskyr
Copy link
Contributor

obskyr commented Feb 16, 2022

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:

  1. Install MSYS2.
  2. Run the “MSYS2 MinGW x64” shell.
  3. Run pacman -Syu to update packages.
  4. Run pacman -S binutils.
  5. MSYS2 has a Flashrom package now, so run wget https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-flashrom/PKGBUILD.
  6. Run makepkg-mingw -sCLf.
  7. Manually copy libusb-1.0.dll, libftdi1.dll, and libwinpthread-1.dll from /mingw64/bin into the build directory pkg/mingw-w64-x86_64-flashrom/mingw64/bin/flashrom.exe and delete libflashrom-1.dll.
  8. The build directory pkg/mingw-w64-x86_64-flashrom/mingw64/bin/ now contains flashrom.exe and 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!

@mightymos
Copy link

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.

@obskyr
Copy link
Contributor Author

obskyr commented Feb 16, 2022

@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
Copy link

@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

@obskyr
Copy link
Contributor Author

obskyr commented Feb 16, 2022

Yep, alright, so step #⁠7 is still relevant.

@GeographicCone
Copy link

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.

@Droid-MAX
Copy link

try SNANDer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants