diff mbox

[lto-plugin] : Don't use sys/wait.h for mingw targets

Message ID AANLkTinO4Yw0DBBYyouNSMPkN3UsVUQ=+QTaOJUVh3wN@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Nov. 30, 2010, 7:05 a.m. UTC
Hello,

in lto-plugin.c there is the header sys/wait.h used, which isn't
present for mingw targets. This patch adds check for this header and
make its use conditionally. Rest of the patch is the result of a
'autoreconf -I ../conf'.

2010-11-30  Kai Tietz

        * config.h.in: Regenerated.
        * configure: Regenerated.
        * Makefile.in: Regenerated.
        * configure.ac (AC_CHECK_HEADERS): Check for sys/wait.h.
        * lto-plugin.c:  Include sys/wait.h conditionally.
        * aclocal.m4: Regenerated.

Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
for apply?

Regards,
Kai

Comments

Richard Biener Nov. 30, 2010, 11:29 a.m. UTC | #1
On Tue, Nov 30, 2010 at 8:05 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> in lto-plugin.c there is the header sys/wait.h used, which isn't
> present for mingw targets. This patch adds check for this header and
> make its use conditionally. Rest of the patch is the result of a
> 'autoreconf -I ../conf'.
>
> 2010-11-30  Kai Tietz
>
>        * config.h.in: Regenerated.
>        * configure: Regenerated.
>        * Makefile.in: Regenerated.
>        * configure.ac (AC_CHECK_HEADERS): Check for sys/wait.h.
>        * lto-plugin.c:  Include sys/wait.h conditionally.
>        * aclocal.m4: Regenerated.
>
> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
> for apply?
>
> Regards,
> Kai
>
> --
> |  (\_/) This is Bunny. Copy and paste
> | (='.'=) Bunny into your signature to help
> | (")_(") him gain world domination
>
> Index: configure.ac
> ===================================================================
> --- configure.ac        (revision 167289)
> +++ configure.ac        (working copy)
> @@ -22,6 +22,7 @@
>  esac
>  AC_TYPE_INT64_T
>  AC_TYPE_UINT64_T
> +AC_CHECK_HEADERS(sys/wait.h)
>  AC_CONFIG_FILES(Makefile)
>  AC_CONFIG_HEADERS(config.h)

Just append sys/wait.h to config.h here.

Ok with that change.

Thanks,
Richard.

>  AC_OUTPUT
> Index: lto-plugin.c
> ===================================================================
> --- lto-plugin.c        (revision 167289)
> +++ lto-plugin.c        (working copy)
> @@ -47,7 +47,9 @@
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <sys/types.h>
> +#ifdef HAVE_SYS_WAIT_H
>  #include <sys/wait.h>
> +#endif
>  #include <libiberty.h>
>  #include <hashtab.h>
>  #include "../gcc/lto/common.h"
>
Kai Tietz Nov. 30, 2010, 5:53 p.m. UTC | #2
2010/11/30 Richard Guenther <richard.guenther@gmail.com>:
> On Tue, Nov 30, 2010 at 8:05 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Hello,
>>
>> in lto-plugin.c there is the header sys/wait.h used, which isn't
>> present for mingw targets. This patch adds check for this header and
>> make its use conditionally. Rest of the patch is the result of a
>> 'autoreconf -I ../conf'.
>>
>> 2010-11-30  Kai Tietz
>>
>>        * config.h.in: Regenerated.
>>        * configure: Regenerated.
>>        * Makefile.in: Regenerated.
>>        * configure.ac (AC_CHECK_HEADERS): Check for sys/wait.h.
>>        * lto-plugin.c:  Include sys/wait.h conditionally.
>>        * aclocal.m4: Regenerated.
>>
>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>> for apply?
>>
>> Regards,
>> Kai
>>
>> --
>> |  (\_/) This is Bunny. Copy and paste
>> | (='.'=) Bunny into your signature to help
>> | (")_(") him gain world domination
>>
>> Index: configure.ac
>> ===================================================================
>> --- configure.ac        (revision 167289)
>> +++ configure.ac        (working copy)
>> @@ -22,6 +22,7 @@
>>  esac
>>  AC_TYPE_INT64_T
>>  AC_TYPE_UINT64_T
>> +AC_CHECK_HEADERS(sys/wait.h)
>>  AC_CONFIG_FILES(Makefile)
>>  AC_CONFIG_HEADERS(config.h)
>
> Just append sys/wait.h to config.h here.
>
> Ok with that change.
>
> Thanks,
> Richard.
>
>>  AC_OUTPUT
>> Index: lto-plugin.c
>> ===================================================================
>> --- lto-plugin.c        (revision 167289)
>> +++ lto-plugin.c        (working copy)
>> @@ -47,7 +47,9 @@
>>  #include <unistd.h>
>>  #include <fcntl.h>
>>  #include <sys/types.h>
>> +#ifdef HAVE_SYS_WAIT_H
>>  #include <sys/wait.h>
>> +#endif
>>  #include <libiberty.h>
>>  #include <hashtab.h>
>>  #include "../gcc/lto/common.h"
>>
>

Hmm, are you sure that this is right?  AC_CONFIG_HEADERS and
AC_CHECK_HEADERS are two different things, at least as far as I read
in documentation about them.

Kai
Richard Biener Dec. 1, 2010, 10:39 a.m. UTC | #3
On Tue, Nov 30, 2010 at 6:53 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> 2010/11/30 Richard Guenther <richard.guenther@gmail.com>:
>> On Tue, Nov 30, 2010 at 8:05 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
>>> Hello,
>>>
>>> in lto-plugin.c there is the header sys/wait.h used, which isn't
>>> present for mingw targets. This patch adds check for this header and
>>> make its use conditionally. Rest of the patch is the result of a
>>> 'autoreconf -I ../conf'.
>>>
>>> 2010-11-30  Kai Tietz
>>>
>>>        * config.h.in: Regenerated.
>>>        * configure: Regenerated.
>>>        * Makefile.in: Regenerated.
>>>        * configure.ac (AC_CHECK_HEADERS): Check for sys/wait.h.
>>>        * lto-plugin.c:  Include sys/wait.h conditionally.
>>>        * aclocal.m4: Regenerated.
>>>
>>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>>> for apply?
>>>
>>> Regards,
>>> Kai
>>>
>>> --
>>> |  (\_/) This is Bunny. Copy and paste
>>> | (='.'=) Bunny into your signature to help
>>> | (")_(") him gain world domination
>>>
>>> Index: configure.ac
>>> ===================================================================
>>> --- configure.ac        (revision 167289)
>>> +++ configure.ac        (working copy)
>>> @@ -22,6 +22,7 @@
>>>  esac
>>>  AC_TYPE_INT64_T
>>>  AC_TYPE_UINT64_T
>>> +AC_CHECK_HEADERS(sys/wait.h)
>>>  AC_CONFIG_FILES(Makefile)
>>>  AC_CONFIG_HEADERS(config.h)
>>
>> Just append sys/wait.h to config.h here.
>>
>> Ok with that change.
>>
>> Thanks,
>> Richard.
>>
>>>  AC_OUTPUT
>>> Index: lto-plugin.c
>>> ===================================================================
>>> --- lto-plugin.c        (revision 167289)
>>> +++ lto-plugin.c        (working copy)
>>> @@ -47,7 +47,9 @@
>>>  #include <unistd.h>
>>>  #include <fcntl.h>
>>>  #include <sys/types.h>
>>> +#ifdef HAVE_SYS_WAIT_H
>>>  #include <sys/wait.h>
>>> +#endif
>>>  #include <libiberty.h>
>>>  #include <hashtab.h>
>>>  #include "../gcc/lto/common.h"
>>>
>>
>
> Hmm, are you sure that this is right?  AC_CONFIG_HEADERS and
> AC_CHECK_HEADERS are two different things, at least as far as I read
> in documentation about them.

Oh, right.  Parse error on my side.

Richard.

> Kai
>
> --
> |  (\_/) This is Bunny. Copy and paste
> | (='.'=) Bunny into your signature to help
> | (")_(") him gain world domination
>
Kai Tietz Dec. 1, 2010, 4:58 p.m. UTC | #4
2010/12/1 Richard Guenther <richard.guenther@gmail.com>:
> On Tue, Nov 30, 2010 at 6:53 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> 2010/11/30 Richard Guenther <richard.guenther@gmail.com>:
>>> On Tue, Nov 30, 2010 at 8:05 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
>>>> Hello,
>>>>
>>>> in lto-plugin.c there is the header sys/wait.h used, which isn't
>>>> present for mingw targets. This patch adds check for this header and
>>>> make its use conditionally. Rest of the patch is the result of a
>>>> 'autoreconf -I ../conf'.
>>>>
>>>> 2010-11-30  Kai Tietz
>>>>
>>>>        * config.h.in: Regenerated.
>>>>        * configure: Regenerated.
>>>>        * Makefile.in: Regenerated.
>>>>        * configure.ac (AC_CHECK_HEADERS): Check for sys/wait.h.
>>>>        * lto-plugin.c:  Include sys/wait.h conditionally.
>>>>        * aclocal.m4: Regenerated.
>>>>
>>>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>>>> for apply?
>>>>
>>>> Regards,
>>>> Kai
>>>>
>>>> --
>>>> |  (\_/) This is Bunny. Copy and paste
>>>> | (='.'=) Bunny into your signature to help
>>>> | (")_(") him gain world domination
>>>>
>>>> Index: configure.ac
>>>> ===================================================================
>>>> --- configure.ac        (revision 167289)
>>>> +++ configure.ac        (working copy)
>>>> @@ -22,6 +22,7 @@
>>>>  esac
>>>>  AC_TYPE_INT64_T
>>>>  AC_TYPE_UINT64_T
>>>> +AC_CHECK_HEADERS(sys/wait.h)
>>>>  AC_CONFIG_FILES(Makefile)
>>>>  AC_CONFIG_HEADERS(config.h)
>>>
>>> Just append sys/wait.h to config.h here.
>>>
>>> Ok with that change.
>>>
>>> Thanks,
>>> Richard.
>>>
>>>>  AC_OUTPUT
>>>> Index: lto-plugin.c
>>>> ===================================================================
>>>> --- lto-plugin.c        (revision 167289)
>>>> +++ lto-plugin.c        (working copy)
>>>> @@ -47,7 +47,9 @@
>>>>  #include <unistd.h>
>>>>  #include <fcntl.h>
>>>>  #include <sys/types.h>
>>>> +#ifdef HAVE_SYS_WAIT_H
>>>>  #include <sys/wait.h>
>>>> +#endif
>>>>  #include <libiberty.h>
>>>>  #include <hashtab.h>
>>>>  #include "../gcc/lto/common.h"
>>>>
>>>
>>
>> Hmm, are you sure that this is right?  AC_CONFIG_HEADERS and
>> AC_CHECK_HEADERS are two different things, at least as far as I read
>> in documentation about them.
>
> Oh, right.  Parse error on my side.
>
> Richard.
>
>> Kai
>>
>> --
>> |  (\_/) This is Bunny. Copy and paste
>> | (='.'=) Bunny into your signature to help
>> | (")_(") him gain world domination
>>
>


Applied at revision 167343.

Kai
alsp Dec. 2, 2010, 12:15 p.m. UTC | #5
>>>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>>>> for apply?

Hi,

I've been trying to compile GCC on MinGW for the past few days and was stuck
on the wait.h problem until I luckily came across this post. It has resolved
that particular issue but now I'm getting a different error:

/bin/sh ./libtool --tag=CC   --mode=compile mingw32-gcc -DHAVE_CONFIG_H -I.
-I..
/../src/lto-plugin  -I../../src/lto-plugin/../include -DHAVE_CONFIG_H  -Wall
-We
rror -g -O2 -D__USE_MINGW_ACCESS -c -o lto-plugin.lo
../../src/lto-plugin/lto-pl
ugin.c
libtool: compile:  mingw32-gcc -DHAVE_CONFIG_H -I. -I../../src/lto-plugin
-I../.
./src/lto-plugin/../include -DHAVE_CONFIG_H -Wall -Werror -g -O2
-D__USE_MINGW_A
CCESS -c ../../src/lto-plugin/lto-plugin.c -o lto-plugin.o
cc1.exe: warnings being treated as errors
../../src/lto-plugin/lto-plugin.c: In function 'exec_lto_wrapper':
../../src/lto-plugin/lto-plugin.c:556:3: error: implicit declaration of
function
 'WIFEXITED'
../../src/lto-plugin/lto-plugin.c:556:3: error: implicit declaration of
function
 'WEXITSTATUS'
make[2]: *** [lto-plugin.lo] Error 1

I've installed MSYS, MinGW, Binutils, Flex, Bison, GMP, MPFR, MPC and am
running Windows 7 32-bit.

Not sure what other details may be useful - let me know if there are any
other details that I can provide.

Thanks,
Alan
Kai Tietz Dec. 2, 2010, 12:53 p.m. UTC | #6
2010/12/2 alsp <alansparkstar@gmail.com>:
>
>>>>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>>>>> for apply?
>
> Hi,
>
> I've been trying to compile GCC on MinGW for the past few days and was stuck
> on the wait.h problem until I luckily came across this post. It has resolved
> that particular issue but now I'm getting a different error:
>
> /bin/sh ./libtool --tag=CC   --mode=compile mingw32-gcc -DHAVE_CONFIG_H -I.
> -I..
> /../src/lto-plugin  -I../../src/lto-plugin/../include -DHAVE_CONFIG_H  -Wall
> -We
> rror -g -O2 -D__USE_MINGW_ACCESS -c -o lto-plugin.lo
> ../../src/lto-plugin/lto-pl
> ugin.c
> libtool: compile:  mingw32-gcc -DHAVE_CONFIG_H -I. -I../../src/lto-plugin
> -I../.
> ./src/lto-plugin/../include -DHAVE_CONFIG_H -Wall -Werror -g -O2
> -D__USE_MINGW_A
> CCESS -c ../../src/lto-plugin/lto-plugin.c -o lto-plugin.o
> cc1.exe: warnings being treated as errors
> ../../src/lto-plugin/lto-plugin.c: In function 'exec_lto_wrapper':
> ../../src/lto-plugin/lto-plugin.c:556:3: error: implicit declaration of
> function
>  'WIFEXITED'
> ../../src/lto-plugin/lto-plugin.c:556:3: error: implicit declaration of
> function
>  'WEXITSTATUS'
> make[2]: *** [lto-plugin.lo] Error 1
>
> I've installed MSYS, MinGW, Binutils, Flex, Bison, GMP, MPFR, MPC and am
> running Windows 7 32-bit.
>
> Not sure what other details may be useful - let me know if there are any
> other details that I can provide.
>
> Thanks,
> Alan

Alan,

sorry for that. I have the following defines in my local headers
(which aren't standard) and I will prepare a patch for lto-plugin.c
for this.
If you define '#define WEXITSTATUS(w)    (((w) >> 8) & 0xff)' and
'#define WIFEXITED(w)      (((w) & 0xff) == 0)', the build will be
then successful.

For win32 the result of status can be SIGABRT in the lower 8-bits (if
child got a signal), or in the upper 8 bit the exit-code.

Regards,
Kai
diff mbox

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 167289)
+++ configure.ac	(working copy)
@@ -22,6 +22,7 @@ 
 esac
 AC_TYPE_INT64_T
 AC_TYPE_UINT64_T
+AC_CHECK_HEADERS(sys/wait.h)
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_HEADERS(config.h)
 AC_OUTPUT
Index: lto-plugin.c
===================================================================
--- lto-plugin.c	(revision 167289)
+++ lto-plugin.c	(working copy)
@@ -47,7 +47,9 @@ 
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
 #include <libiberty.h>
 #include <hashtab.h>
 #include "../gcc/lto/common.h"