2012-08-28 14:28:47

by Anderson Lizardo

[permalink] [raw]
Subject: [PATCH BlueZ] input: Fix build error due to O_CLOEXEC

On some (not so old) systems like Ubuntu 10.04 LTS, O_CLOEXEC is only
defined if _GNU_SOURCE is defined.

This fixes this build error:

profiles/input/hog_device.c: In function 'hog_device_register':
profiles/input/hog_device.c:712: error: 'O_CLOEXEC' undeclared (first
use in this function)
profiles/input/hog_device.c:712: error: (Each undeclared identifier is
reported only once
profiles/input/hog_device.c:712: error: for each function it appears
in.)
---
profiles/input/hog_device.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c
index 000f173..b502274 100644
--- a/profiles/input/hog_device.c
+++ b/profiles/input/hog_device.c
@@ -27,6 +27,7 @@
#include <config.h>
#endif

+#define _GNU_SOURCE
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
--
1.7.9.5



2012-08-30 13:16:49

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ] input: Fix build error due to O_CLOEXEC

Hi Lucas,

On Tue, Aug 28, 2012 at 8:55 PM, Anderson Lizardo
<[email protected]> wrote:
> On Tue, Aug 28, 2012 at 8:15 PM, Lucas De Marchi
> <[email protected]> wrote:
>>> +#define _GNU_SOURCE
>>
>> this should be already in our config.h. It seems like we are missing
>> the following in our configure.ac:
>>
>> AC_USE_SYSTEM_EXTENSIONS.
>>
>> Btw, we should remove the other definitions of _GNU_SOURCE
>
> Nice, I wasn't aware of this feature. Does it require any newer
> autoconf version?
>
> I can try this tomorrow and send a new patch set removing the
> _GNU_SOURCE defines.

I just sent a new patch using this macro (it exists since autoconf
2.60). Thanks for the heads up.

Johan: please apply the new patch "build: Use AC_USE_SYSTEM_EXTENSIONS
for POSIX/C extensions" instead of this one.

Thanks,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2012-08-29 00:55:32

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ] input: Fix build error due to O_CLOEXEC

Hi Lucas,

On Tue, Aug 28, 2012 at 8:15 PM, Lucas De Marchi
<[email protected]> wrote:
>> +#define _GNU_SOURCE
>
> this should be already in our config.h. It seems like we are missing
> the following in our configure.ac:
>
> AC_USE_SYSTEM_EXTENSIONS.
>
> Btw, we should remove the other definitions of _GNU_SOURCE

Nice, I wasn't aware of this feature. Does it require any newer
autoconf version?

I can try this tomorrow and send a new patch set removing the
_GNU_SOURCE defines.

Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2012-08-29 00:15:47

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH BlueZ] input: Fix build error due to O_CLOEXEC

On Tue, Aug 28, 2012 at 11:28 AM, Anderson Lizardo
<[email protected]> wrote:
> On some (not so old) systems like Ubuntu 10.04 LTS, O_CLOEXEC is only
> defined if _GNU_SOURCE is defined.
>
> This fixes this build error:
>
> profiles/input/hog_device.c: In function 'hog_device_register':
> profiles/input/hog_device.c:712: error: 'O_CLOEXEC' undeclared (first
> use in this function)
> profiles/input/hog_device.c:712: error: (Each undeclared identifier is
> reported only once
> profiles/input/hog_device.c:712: error: for each function it appears
> in.)
> ---
> profiles/input/hog_device.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c
> index 000f173..b502274 100644
> --- a/profiles/input/hog_device.c
> +++ b/profiles/input/hog_device.c
> @@ -27,6 +27,7 @@
> #include <config.h>
> #endif
>
> +#define _GNU_SOURCE

this should be already in our config.h. It seems like we are missing
the following in our configure.ac:

AC_USE_SYSTEM_EXTENSIONS.

Btw, we should remove the other definitions of _GNU_SOURCE

> #include <stdlib.h>
> #include <errno.h>
> #include <unistd.h>


Lucas De Marchi