[PATCH] Support cross compiling with MinGW-w64 on Debian GNU/Linux

Maxim Dounin mdounin at mdounin.ru
Tue Oct 14 14:10:22 UTC 2014


Hello!

On Tue, Oct 14, 2014 at 10:42:33PM +0900, Kouhei Sutou wrote:

> >> Compiler:
> >> 
> >>     % x86_64-w64-mingw32-gcc --version
> >>     x86_64-w64-mingw32-gcc (GCC) 4.9.1
> > 
> > While this patch fixes compilation with MinGW-w64 gcc, it breaks 
> > compilation with MinGW gcc, which isn't good.
> 
> Oh...
> Could you show me the build errors? I don't have MinGW on my
> machine.

It ends up using 32-bit off_t as it doesn't understand 
_FILE_OFFSET_BITS, and then build fails due to this.

No exact error message as I've already reverted VM where MinGW gcc 
was installed to a previous state, sorry.

[...]

> # HG changeset patch
> # User Kouhei Sutou <kou at cozmixng.org>
> # Date 1413293783 -32400
> #      Tue Oct 14 22:36:23 2014 +0900
> # Node ID 9d6d7b34f93bfc5363e16f0340a136a27755354b
> # Parent  35b8e5e985083976ba62914fc5953dbd2a3b954b
> Win32: made build-able with MinGW-w64
> 
> Compiler:
> 
>     % x86_64-w64-mingw32-gcc --version
>     x86_64-w64-mingw32-gcc (GCC) 4.9.1
>     Copyright (C) 2014 Free Software Foundation, Inc.
>     This is free software; see the source for copying conditions.  There is NO
>     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[...]

It should be fine to add a dot to the first line (and probably 
"gcc"), and drop everything else.  I.e.,

Win32: made build-able with MinGW-w64 gcc.

[...]

> +#if defined(__GNUC__) && defined(_WIN64)

Shouldn't it be for all compilers, not just gcc?

> +#define NGX_PTR_SIZE            8
> +#define NGX_SIZE_T_LEN          (sizeof("-9223372036854775808") - 1)
> +#define NGX_MAX_SIZE_T_VALUE    9223372036854775807
> +#define NGX_TIME_T_LEN          (sizeof("-9223372036854775808") - 1)
> +#define NGX_TIME_T_SIZE         8
> +#else
>  #define NGX_PTR_SIZE            4
>  #define NGX_SIZE_T_LEN          (sizeof("-2147483648") - 1)
>  #define NGX_MAX_SIZE_T_VALUE    2147483647
>  #define NGX_TIME_T_LEN          (sizeof("-2147483648") - 1)
>  #define NGX_TIME_T_SIZE         4
> +#endif
>  #define NGX_OFF_T_LEN           (sizeof("-9223372036854775807") - 1)
>  #define NGX_MAX_OFF_T_VALUE     9223372036854775807
>  #define NGX_SIG_ATOMIC_T_SIZE   4

Style nit: this needs more empty lines before/after preprocessor 
directives.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list