[flashrom] Trouble cross-compiling for Windows

R. Diez rdiezmail-flashrom at yahoo.de
Fri Jan 5 16:13:42 CET 2018


Hi all:

First of all, many thanks for flashrom.

I found cross-compiling for Windows on my Ubuntu 16.04.3 LTS 
unnecessarily difficult. I am following the instructions on this page:

   https://flashrom.org/Windows

These are the points I would like to raise:

1) Although that web page is a Wiki, I guess that only the flashrom team 
can modify the pages, right? That is the reason why I haven't directly 
contributed to that page yet.

2) The build instructions should mention that detailed error messages go 
to file build_details.txt . The error messages written to stdout during 
the configuration phase (for example, when looking for the libusb header 
file) are very generic and do not provide enough information.

3) Option "-Werror" ("cc1: warnings being treated as errors") should not 
really be enabled for end-users like me. This way, you are forced to fix 
every little warning, and warnings vary with GCC versions.

In fact, there is already a warning about such a scenario in the README 
file:

----8<----8<----
Compiler quirks:

If you are using clang and if you want to enable only one driver, you 
may hit an overzealous compiler warning from clang. Compile with "make 
WARNERROR=no" to force it to continue and enjoy.
----8<----8<----

But I hear your grumble. 8-) Maybe somebody with more public exposure 
will convince you:

   https://blog.flameeyes.eu/2009/02/future-proof-your-code-dont-use-werror/

In the case of flashrom, this all translates to setting WARNERROR=no as 
the default, and WARNERROR=yes when building on your build server.

4) Symbol __MINGW_PRINTF_FORMAT was not defined on my system. 
Apparently, mingw does not always define it. There is advise on the 
Internet about #ifdef'ing its usage, but I did not quite understand it all.

5) I saw the following warnings:

ich_descriptors.c: In function 'prettyprint_ich_descriptor_content':
ich_descriptors.c:142: warning: format '%5zd' expects type 'signed 
size_t', but argument 3 has type 'ssize_t'
ich_descriptors.c:148: warning: format '%5zd' expects type 'signed 
size_t', but argument 3 has type 'ssize_t'

I tried to fix them quickly, but it turns out that the simple cast 
(signed size_t) is not valid in C. I am not sure what the best fix for 
this issue is.

6) Please mention how to generate the HTML man page in the build 
instructions. You do not normally want to build and install as root, so 
the HTML page is the most convenient way to look at the manpage for the 
version you are building.

You need to specify both "all" and "flashrom.8.html" as targets in order 
to build the normal binary plus the HTML manpage.

7) Specifying "CONFIG_FT2232_SPI=yes" does not break the build if the 
FTDI driver is not found (if ftdi.h is not there). That is a bit lame, 
as you only realise later on when trying to use the executable that your 
programmer is not there.

However, if you do not turn off these two devices:

   CONFIG_CH341A_SPI=no
   CONFIG_DEDIPROG=no

And you do not have the necessary files for libusb-1.0, then the build 
does break:

   Checking for libusb-1.0 headers... found.
   Checking if libusb-1.0 is usable... no.
   The following features require libusb-1.0: CONFIG_CH341A_SPI.
   Please install libusb-1.0 or disable all features
   mentioned above by specifying make CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no
   See README for more information.

8) I could not find any documentation for the configuration flags (like 
CONFIG_FT2232_SPI=yes/no). And reading the makefile is not easy.


Please copy me on any answers, as I am not subscribed to this mailing list.

Regards,
   R. Diez



More information about the flashrom mailing list