[PATCH] Support cross compiling with MinGW-w64 on Debian GNU/Linux
Maxim Dounin
mdounin at mdounin.ru
Tue Oct 14 00:22:18 UTC 2014
Hello!
On Sat, Oct 11, 2014 at 09:29:02PM +0900, Kouhei Sutou wrote:
> Hi,
>
> Sorry... I missed your reply...
>
> I attach a new patch that is applied your comments.
>
> In <20141008142441.GE31276 at mdounin.ru>
> "Re: [PATCH] Support cross compiling with MinGW-w64 on Debian GNU/Linux" on Wed, 8 Oct 2014 18:24:41 +0400,
> Maxim Dounin <mdounin at mdounin.ru> wrote:
>
> >> diff --git a/src/event/modules/ngx_iocp_module.c b/src/event/modules/ngx_iocp_module.c
> >> --- a/src/event/modules/ngx_iocp_module.c
> >> +++ b/src/event/modules/ngx_iocp_module.c
> ...
> >
> > Looks fine, though I think it should be a separate patch.
>
> I see!
> I did: http://mailman.nginx.org/pipermail/nginx-devel/2014-October/006072.html
This and ngx_wsasend_chain.c patches committed (with minor changes
to commit logs), thanks.
[...]
> # HG changeset patch
> # User Kouhei Sutou <kou at cozmixng.org>
> # Date 1413030061 -32400
> # Sat Oct 11 21:21:01 2014 +0900
> # Node ID 68c7ba284f40a5d97f774380cf4cf80259b15585
> # Parent 21043ce2a0058154687a779b4c9b0f241fa7e88a
> Win32: made build-able with MinGW-w64
>
> 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.
[...]
> #include <stdio.h>
> #include <stdlib.h>
> #include <stdarg.h>
> +#ifdef __GNUC__
> +#include <stdint.h> /* intptr_t and uintptr_t */
> +#endif
> #include <ctype.h>
> #include <locale.h>
Minor nit: the comment here looks unneeded.
[...]
> typedef __int64 int64_t;
> typedef unsigned __int64 uint64_t;
>
> -#ifndef __WATCOMC__
> +#if defined(__WATCOMC__) || defined(__GNUC__)
> +/* do nothing */
> +#else
> typedef int intptr_t;
> typedef u_int uintptr_t;
> #endif
The construction looks awfull, it should be
#if !defined(...) && !defined(...)
...
#endif
instead.
[...]
> #define NGX_PTR_SIZE 4
> #define NGX_SIZE_T_LEN (sizeof("-2147483648") - 1)
> #define NGX_MAX_SIZE_T_VALUE 2147483647
Note well: the ngx_win32_config.h defines various constants,
including ones quoted, assuming 32-bit build. 64-bit build will
be flawed unless these constands are changed appropriately.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list