[U-Boot] Using MinGW gcc cross-compiling host tools for Windows broken

Bin Meng bmeng.cn at gmail.com
Mon Oct 14 09:46:16 UTC 2019

Hi Peter,

I noticed that you were the first one that added support to build
native Win32 tools using MinGW GCC via:

commit 2f8d396b9302eddcd8d552648e101a46b7a80acd
Author: Peter Tyser <ptyser at xes-inc.com>
Date:   Fri Mar 13 18:54:51 2009 -0500

    Add support for building native win32 tools

    Add support for compiling the host tools in the tools directory using
    the MinGW toolchain.  This produces executables which can be used on
    standard Windows computers without requiring cygwin.

    One must specify the MinGW compiler and strip utilities as if they
    were the host toolchain in order to build win32 executables, eg:

    make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools

    Signed-off-by: Peter Tyser <ptyser at xes-inc.com>

There are also several follow-up commits that fixed the build errors
from time to time:

commit 8b6a4952e6064dc558cb7d5d375990b17491f26f
Author: Vladimir Yakovlev <nagos at inbox.ru>
Date:   Sat Jul 7 10:05:06 2012 +0000

    tools: Fix mingw tools build

    mkenvimage does not build due to missed os_support.o and unsupported
    file modes S_IRGRP S_IWGRP.
    Tested with mingw 4.2.1 on ubuntu 12.04.

    Signed-off-by: Vladimir Yakovlev <nagos at inbox.ru>

commit b050c72d52c4e30d5b978ab6758f8dcdbe5c690c
Author: Mike Frysinger <vapier at gentoo.org>
Date:   Tue Apr 20 05:49:30 2010 -0400

    compiler.h: add uint typedef

    Recent crc changes started using the "uint" type in headers that are used
    on the build system.  This subsequently broke mingw targets as they do not
    provide such a type.  So add this basic typedef to compiler.h so that we
    do not have to worry about this breaking again in the future.

    Signed-off-by: Mike Frysinger <vapier at gentoo.org>

commit faf36c1437c95e4a86835633d9801c5f6396a3c7
Author: Remy Bohmer <linux at bohmer.net>
Date:   Wed Oct 28 22:13:36 2009 +0100

    Fix mingw tools build

    mkimage does not build due to missing strtok_r() and getline()

    Signed-off-by: Remy Bohmer <linux at bohmer.net>

Today I tried to build the Windows tools by following the README, and
got build errors.

$ make HOSTCC=/usr/bin/x86_64-w64-mingw32-gcc tools

note: I am running this from Linux. It's not clear to me whether we
should run this from Windows natively or cross-compile on Linux.

It seems that this MinGW Windows build has been broken for quite a long time.

Will you address this? Thanks!


More information about the U-Boot mailing list