[flashrom] Building on Windows with mingw
Antonio Ospite
ao2 at ao2.it
Tue Feb 27 16:56:04 CET 2018
On Fri, 19 Jan 2018 00:38:53 +0100
Miklos Marton <martonmiklosqdev at gmail.com> wrote:
> Hello all,
>
> I have tried to build the flashrom with mingw on Windows, but the build
> process fails with:
>
> flash.h:336:1: error: '__MINGW_PRINTF_FORMAT' is an unrecognized format
> function
> type [-Werror=format=]
> __attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3)));
>
> I have checked the stdio.h shipped with the mingw installation, but it
> does not contains the __MINGW_PRINTF_FORMAT macro.
>
Hi,
I have been reading about the printf format on MinGW for another
project and I run into this message.
Miklos are you still experiencing the problem?
Here on Linux with mingw-w64 version 5.0.3 the constant is here in
/usr/share/mingw-w64/include/stdio.h
> I have used the latest available mingw-get-setup, because the 20110530
> version (which mentioned in the wiki as known t obe working) segfaults
> when I select the MSYS Basic System feature.
>
> I can build with WARNERROR=no, but some more permanent fix
> recommentation would be warmly welcome!
>
I think a change like the following can help:
diff --git a/flash.h b/flash.h
index a80a9c2..4ae5808 100644
--- a/flash.h
+++ b/flash.h
@@ -359,7 +359,7 @@ void start_logging(void);
int flashrom_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap);
/* Let gcc and clang check for correct printf-style format strings. */
int print(enum flashrom_log_level level, const char *fmt, ...)
-#ifdef __MINGW32__
+#ifdef __MINGW_PRINTF_FORMAT
__attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3)));
#else
__attribute__((format(printf, 2, 3)));
In case the constant is not defined the compiler may still give warnings
but at least the code will compile.
If the change looks good I can forward it through the proper channels.
BTW are patches sent via git-send-email accepted?
Ciao,
Antonio
--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
More information about the flashrom
mailing list