[PATCH] Cygwin: Build cygwin-console-helper with correct compiler
Mark Geisert
mark@maxrnd.com
Wed Jun 26 08:49:00 GMT 2019
Corinna Vinschen wrote:
> On Jun 25 00:54, Mark Geisert wrote:
>> ---
>> winsup/utils/Makefile.in | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in
>> index b64f457e7..cebf39572 100644
>> --- a/winsup/utils/Makefile.in
>> +++ b/winsup/utils/Makefile.in
>> @@ -64,7 +64,7 @@ MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
>> # List all objects to be compiled in MinGW mode. Any object not on this
>> # list will will be compiled in Cygwin mode implicitly, so there is no
>> # need for a CYGWIN_OBJS.
>> -MINGW_OBJS := bloda.o cygcheck.o dump_setup.o ldh.o path.o strace.o
>> +MINGW_OBJS := bloda.o cygcheck.o cygwin-console-helper.o dump_setup.o ldh.o path.o strace.o
>> MINGW_LDFLAGS:=-static
>>
>> CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
>> --
>> 2.21.0
>
> Careful! This leads to a warning when building on 64 bit:
>
> cygwin-console-helper.cc: In function 'int main(int, char**)':
> cygwin-console-helper.cc:8:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> HANDLE h = (HANDLE) strtoul (argv[1], &end, 0);
> ^
> cygwin-console-helper.cc:10:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> h = (HANDLE) strtoul (argv[2], &end, 0);
> ^
>
> Note that strtoul returns an unsigned long. Mingw compiles
> for native Windows, which is LLP64 rather than LP64:
>
> mingw:sizeof(long) == 4
> cygwin:sizeof(long) == 8
>
> This needs fixing as well (use strtoull).
I appreciate the comments. These warnings have "always" been present. I will
submit a separate patch to correct them.
I didn't make clear the reason for this one-line patch to Makefile.in: A 'make
-j 6' over the Cygwin source tree would sometimes fail because the link step for
cygwin-console-helper uses a different gcc than the compile step did in parallel
builds. Can you accept this patch as-is for what it does for builds?
I will over time pay more attention to the make log and submit more patches for
the warnings I see flying by. There's maybe a handful of them, mostly in newlib.
Cheers,
..mark
More information about the Cygwin-patches
mailing list