Patchwork [2/2] libx11: fix nativesdk build on older distros

login
register
mail settings
Submitter Matthew McClintock
Date Sept. 24, 2012, 7:55 p.m.
Message ID <1348516546-26005-2-git-send-email-msm@freescale.com>
Download mbox | patch
Permalink /patch/37139/
State New
Headers show

Comments

Matthew McClintock - Sept. 24, 2012, 7:55 p.m.
makekeys-makekeys.o: In function `main':
makekeys.c:(.text+0x85): undefined reference to `__isoc99_sscanf'
makekeys.c:(.text+0xa7): undefined reference to `__isoc99_sscanf'
collect2: ld returned 1 exit status
make: *** [makekeys] Error 1

Older libc do not have this defined, we can use the -D_GNU_SOURCE
to the compiler to prevent generating calls to this function and
make linking work

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 .../xorg-lib/libx11/use_host_cc_for_utils.patch    |   12 ++++++++++++
 meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb     |    3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
McClintock Matthew-B29882 - Sept. 24, 2012, 8:13 p.m.
On Mon, Sep 24, 2012 at 2:55 PM, Matthew McClintock <msm@freescale.com> wrote:
> makekeys-makekeys.o: In function `main':
> makekeys.c:(.text+0x85): undefined reference to `__isoc99_sscanf'
> makekeys.c:(.text+0xa7): undefined reference to `__isoc99_sscanf'
> collect2: ld returned 1 exit status
> make: *** [makekeys] Error 1
>
> Older libc do not have this defined, we can use the -D_GNU_SOURCE
> to the compiler to prevent generating calls to this function and
> make linking work
>
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
>  .../xorg-lib/libx11/use_host_cc_for_utils.patch    |   12 ++++++++++++
>  meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb     |    3 ++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>
> diff --git a/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
> new file mode 100644
> index 0000000..08ba39a
> --- /dev/null
> +++ b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
> @@ -0,0 +1,12 @@
> +Index: libX11-1.5.0/src/Makefile.am
> +===================================================================
> +--- libX11-1.5.0.orig/src/Makefile.am
> ++++ libX11-1.5.0/src/Makefile.am
> +@@ -420,6 +420,6 @@ ks_tables.h: $(KEYSYMDEFS) $(top_builddi
> +       mv ks_tables_h $@
> +
> + $(top_builddir)/src/util/makekeys$(EXEEXT): force
> +-      cd util && $(MAKE)
> ++      cd util && $(MAKE) CC=gcc CCLD=gcc LDFLAGS= CFLAGS=-D_GNU_SOURCE

I kicked off a build right after testing on one machine, and this is
not quite right. Mostly I think I Need more CFLAGS to build 32 or 64
bit native binaries so they can run on the target system properly.
E.g. if I don't have:

/lib/ld.so.1: No such file or directory

-M

> +
> + force:
> diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
> index 94e2051..3e00dd8 100644
> --- a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
> +++ b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
> @@ -1,11 +1,12 @@
>  require libx11.inc
>  inherit gettext
>
> -PR = "${INC_PR}.2"
> +PR = "${INC_PR}.3"
>
>  BBCLASSEXTEND = "native nativesdk"
>
>  SRC_URI += "file://keysymdef_include.patch"
> +SRC_URI_append_virtclass-nativesdk += "file://use_host_cc_for_utils.patch"
>
>  SRC_URI[md5sum] = "78b4b3bab4acbdf0abcfca30a8c70cc6"
>  SRC_URI[sha256sum] = "c382efd7e92bfc3cef39a4b7f1ecf2744ba4414a705e3bc1e697f75502bd4d86"
> --
> 1.7.9.7
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Chris Larson - Sept. 24, 2012, 9:08 p.m.
On Mon, Sep 24, 2012 at 1:13 PM, McClintock Matthew-B29882
<B29882@freescale.com> wrote:
> On Mon, Sep 24, 2012 at 2:55 PM, Matthew McClintock <msm@freescale.com> wrote:
>> makekeys-makekeys.o: In function `main':
>> makekeys.c:(.text+0x85): undefined reference to `__isoc99_sscanf'
>> makekeys.c:(.text+0xa7): undefined reference to `__isoc99_sscanf'
>> collect2: ld returned 1 exit status
>> make: *** [makekeys] Error 1
>>
>> Older libc do not have this defined, we can use the -D_GNU_SOURCE
>> to the compiler to prevent generating calls to this function and
>> make linking work
>>
>> Signed-off-by: Matthew McClintock <msm@freescale.com>
>> ---
>>  .../xorg-lib/libx11/use_host_cc_for_utils.patch    |   12 ++++++++++++
>>  meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb     |    3 ++-
>>  2 files changed, 14 insertions(+), 1 deletion(-)
>>  create mode 100644 meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>>
>> diff --git a/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>> new file mode 100644
>> index 0000000..08ba39a
>> --- /dev/null
>> +++ b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>> @@ -0,0 +1,12 @@
>> +Index: libX11-1.5.0/src/Makefile.am
>> +===================================================================
>> +--- libX11-1.5.0.orig/src/Makefile.am
>> ++++ libX11-1.5.0/src/Makefile.am
>> +@@ -420,6 +420,6 @@ ks_tables.h: $(KEYSYMDEFS) $(top_builddi
>> +       mv ks_tables_h $@
>> +
>> + $(top_builddir)/src/util/makekeys$(EXEEXT): force
>> +-      cd util && $(MAKE)
>> ++      cd util && $(MAKE) CC=gcc CCLD=gcc LDFLAGS= CFLAGS=-D_GNU_SOURCE

Isn't the makekeys build already using CC_FOR_BUILD? That's what is
implied by the libx11.inc export of those variables. So it seems a bit
unnecessary to pass in gcc expliciltly.
Saul Wold - Sept. 24, 2012, 9:52 p.m.
On 09/24/2012 12:55 PM, Matthew McClintock wrote:
> makekeys-makekeys.o: In function `main':
> makekeys.c:(.text+0x85): undefined reference to `__isoc99_sscanf'
> makekeys.c:(.text+0xa7): undefined reference to `__isoc99_sscanf'
> collect2: ld returned 1 exit status
> make: *** [makekeys] Error 1
>
> Older libc do not have this defined, we can use the -D_GNU_SOURCE
> to the compiler to prevent generating calls to this function and
> make linking work
>
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
>   .../xorg-lib/libx11/use_host_cc_for_utils.patch    |   12 ++++++++++++
>   meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb     |    3 ++-
>   2 files changed, 14 insertions(+), 1 deletion(-)
>   create mode 100644 meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>
> diff --git a/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
> new file mode 100644
> index 0000000..08ba39a
> --- /dev/null
> +++ b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch

This patch needs a header!


> @@ -0,0 +1,12 @@
> +Index: libX11-1.5.0/src/Makefile.am
> +===================================================================
> +--- libX11-1.5.0.orig/src/Makefile.am
> ++++ libX11-1.5.0/src/Makefile.am
> +@@ -420,6 +420,6 @@ ks_tables.h: $(KEYSYMDEFS) $(top_builddi
> + 	mv ks_tables_h $@
> +
> + $(top_builddir)/src/util/makekeys$(EXEEXT): force
> +-	cd util && $(MAKE)
> ++	cd util && $(MAKE) CC=gcc CCLD=gcc LDFLAGS= CFLAGS=-D_GNU_SOURCE

Is hardcoding 'gcc' here really the right thing to do?
> +
> + force:
> diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
> index 94e2051..3e00dd8 100644
> --- a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
> +++ b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
> @@ -1,11 +1,12 @@
>   require libx11.inc
>   inherit gettext
>
> -PR = "${INC_PR}.2"
> +PR = "${INC_PR}.3"
>
>   BBCLASSEXTEND = "native nativesdk"
>
>   SRC_URI += "file://keysymdef_include.patch"
> +SRC_URI_append_virtclass-nativesdk += "file://use_host_cc_for_utils.patch"
>
>   SRC_URI[md5sum] = "78b4b3bab4acbdf0abcfca30a8c70cc6"
>   SRC_URI[sha256sum] = "c382efd7e92bfc3cef39a4b7f1ecf2744ba4414a705e3bc1e697f75502bd4d86"
>
McClintock Matthew-B29882 - Sept. 24, 2012, 10:28 p.m.
On Mon, Sep 24, 2012 at 4:08 PM, Chris Larson <clarson@kergoth.com> wrote:
> On Mon, Sep 24, 2012 at 1:13 PM, McClintock Matthew-B29882
> <B29882@freescale.com> wrote:
>> On Mon, Sep 24, 2012 at 2:55 PM, Matthew McClintock <msm@freescale.com> wrote:
>>> makekeys-makekeys.o: In function `main':
>>> makekeys.c:(.text+0x85): undefined reference to `__isoc99_sscanf'
>>> makekeys.c:(.text+0xa7): undefined reference to `__isoc99_sscanf'
>>> collect2: ld returned 1 exit status
>>> make: *** [makekeys] Error 1
>>>
>>> Older libc do not have this defined, we can use the -D_GNU_SOURCE
>>> to the compiler to prevent generating calls to this function and
>>> make linking work
>>>
>>> Signed-off-by: Matthew McClintock <msm@freescale.com>
>>> ---
>>>  .../xorg-lib/libx11/use_host_cc_for_utils.patch    |   12 ++++++++++++
>>>  meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb     |    3 ++-
>>>  2 files changed, 14 insertions(+), 1 deletion(-)
>>>  create mode 100644 meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>>>
>>> diff --git a/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>>> new file mode 100644
>>> index 0000000..08ba39a
>>> --- /dev/null
>>> +++ b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>>> @@ -0,0 +1,12 @@
>>> +Index: libX11-1.5.0/src/Makefile.am
>>> +===================================================================
>>> +--- libX11-1.5.0.orig/src/Makefile.am
>>> ++++ libX11-1.5.0/src/Makefile.am
>>> +@@ -420,6 +420,6 @@ ks_tables.h: $(KEYSYMDEFS) $(top_builddi
>>> +       mv ks_tables_h $@
>>> +
>>> + $(top_builddir)/src/util/makekeys$(EXEEXT): force
>>> +-      cd util && $(MAKE)
>>> ++      cd util && $(MAKE) CC=gcc CCLD=gcc LDFLAGS= CFLAGS=-D_GNU_SOURCE
>
> Isn't the makekeys build already using CC_FOR_BUILD? That's what is
> implied by the libx11.inc export of those variables. So it seems a bit
> unnecessary to pass in gcc expliciltly.

I think this is probably what I was looking for... will try to respin.

-M

> --
> Christopher Larson
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
McClintock Matthew-B29882 - Sept. 24, 2012, 10:28 p.m.
On Mon, Sep 24, 2012 at 4:52 PM, Saul Wold <sgw@linux.intel.com> wrote:
> On 09/24/2012 12:55 PM, Matthew McClintock wrote:
>>
>> makekeys-makekeys.o: In function `main':
>> makekeys.c:(.text+0x85): undefined reference to `__isoc99_sscanf'
>> makekeys.c:(.text+0xa7): undefined reference to `__isoc99_sscanf'
>> collect2: ld returned 1 exit status
>> make: *** [makekeys] Error 1
>>
>> Older libc do not have this defined, we can use the -D_GNU_SOURCE
>> to the compiler to prevent generating calls to this function and
>> make linking work
>>
>> Signed-off-by: Matthew McClintock <msm@freescale.com>
>> ---
>>   .../xorg-lib/libx11/use_host_cc_for_utils.patch    |   12 ++++++++++++
>>   meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb     |    3 ++-
>>   2 files changed, 14 insertions(+), 1 deletion(-)
>>   create mode 100644
>> meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>>
>> diff --git
>> a/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>> b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>> new file mode 100644
>> index 0000000..08ba39a
>> --- /dev/null
>> +++ b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
>
>
> This patch needs a header!

Yes!

>
>
>
>> @@ -0,0 +1,12 @@
>> +Index: libX11-1.5.0/src/Makefile.am
>> +===================================================================
>> +--- libX11-1.5.0.orig/src/Makefile.am
>> ++++ libX11-1.5.0/src/Makefile.am
>> +@@ -420,6 +420,6 @@ ks_tables.h: $(KEYSYMDEFS) $(top_builddi
>> +       mv ks_tables_h $@
>> +
>> + $(top_builddir)/src/util/makekeys$(EXEEXT): force
>> +-      cd util && $(MAKE)
>> ++      cd util && $(MAKE) CC=gcc CCLD=gcc LDFLAGS= CFLAGS=-D_GNU_SOURCE
>
>
> Is hardcoding 'gcc' here really the right thing to do?

Probably not, Chris has made some other suggestions so I will look at
a better v2.

-M

>
>> +
>> + force:
>> diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
>> b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
>> index 94e2051..3e00dd8 100644
>> --- a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
>> +++ b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
>> @@ -1,11 +1,12 @@
>>   require libx11.inc
>>   inherit gettext
>>
>> -PR = "${INC_PR}.2"
>> +PR = "${INC_PR}.3"
>>
>>   BBCLASSEXTEND = "native nativesdk"
>>
>>   SRC_URI += "file://keysymdef_include.patch"
>> +SRC_URI_append_virtclass-nativesdk +=
>> "file://use_host_cc_for_utils.patch"
>>
>>   SRC_URI[md5sum] = "78b4b3bab4acbdf0abcfca30a8c70cc6"
>>   SRC_URI[sha256sum] =
>> "c382efd7e92bfc3cef39a4b7f1ecf2744ba4414a705e3bc1e697f75502bd4d86"
>>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Ross Burton - Sept. 25, 2012, 4:48 p.m.
Whoops, I dropped oe-core.

On 25 September 2012 16:38, McClintock Matthew-B29882
<B29882@freescale.com> wrote:
>>> Older libc do not have this defined, we can use the -D_GNU_SOURCE
>>> to the compiler to prevent generating calls to this function and
>>> make linking work
>>
>> Why isn't this from configure.ac working?
>>
>> # Set common system defines for POSIX extensions, such as _GNU_SOURCE
>> # Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
>> # to avoid autoconf errors.
>> AC_USE_SYSTEM_EXTENSIONS
>
> Do these make it to CC_FOR_BUILD? Here is what it looks like before:

AC_USE_SYSTEM_EXTENSIONS sets _GNU_SOURCE (and more) using AC_DEFINE,
so they end up in config.h... which isn't being included in
makekeys.c.

So the correct and upstreamable fix is to include config.h from makekeys.c.

Ross
McClintock Matthew-B29882 - Sept. 25, 2012, 5:38 p.m.
On Tue, Sep 25, 2012 at 11:48 AM, Burton, Ross <ross.burton@intel.com> wrote:
> Whoops, I dropped oe-core.
>
> On 25 September 2012 16:38, McClintock Matthew-B29882
> <B29882@freescale.com> wrote:
>>>> Older libc do not have this defined, we can use the -D_GNU_SOURCE
>>>> to the compiler to prevent generating calls to this function and
>>>> make linking work
>>>
>>> Why isn't this from configure.ac working?
>>>
>>> # Set common system defines for POSIX extensions, such as _GNU_SOURCE
>>> # Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
>>> # to avoid autoconf errors.
>>> AC_USE_SYSTEM_EXTENSIONS
>>
>> Do these make it to CC_FOR_BUILD? Here is what it looks like before:
>
> AC_USE_SYSTEM_EXTENSIONS sets _GNU_SOURCE (and more) using AC_DEFINE,
> so they end up in config.h... which isn't being included in
> makekeys.c.
>
> So the correct and upstreamable fix is to include config.h from makekeys.c.

I read somewhere (very informative - I know - but I've forgot where)
that you are not supposed to include config.h for CC_FOR_BUILD
targets? I'm not expert and just double checking on this bit as the
correct solution.

--M
McClintock Matthew-B29882 - Sept. 25, 2012, 6:55 p.m.
On Tue, Sep 25, 2012 at 12:38 PM, Matthew McClintock <msm@freescale.com> wrote:
> On Tue, Sep 25, 2012 at 11:48 AM, Burton, Ross <ross.burton@intel.com> wrote:
>> Whoops, I dropped oe-core.
>>
>> On 25 September 2012 16:38, McClintock Matthew-B29882
>> <B29882@freescale.com> wrote:
>>>>> Older libc do not have this defined, we can use the -D_GNU_SOURCE
>>>>> to the compiler to prevent generating calls to this function and
>>>>> make linking work
>>>>
>>>> Why isn't this from configure.ac working?
>>>>
>>>> # Set common system defines for POSIX extensions, such as _GNU_SOURCE
>>>> # Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
>>>> # to avoid autoconf errors.
>>>> AC_USE_SYSTEM_EXTENSIONS
>>>
>>> Do these make it to CC_FOR_BUILD? Here is what it looks like before:
>>
>> AC_USE_SYSTEM_EXTENSIONS sets _GNU_SOURCE (and more) using AC_DEFINE,
>> so they end up in config.h... which isn't being included in
>> makekeys.c.
>>
>> So the correct and upstreamable fix is to include config.h from makekeys.c.
>
> I read somewhere (very informative - I know - but I've forgot where)
> that you are not supposed to include config.h for CC_FOR_BUILD
> targets? I'm not expert and just double checking on this bit as the
> correct solution.

Found it: http://sources.redhat.com/autobook/autobook/autobook_270.html

-M
Ross Burton - Sept. 25, 2012, 7:09 p.m.
On 25 September 2012 19:55, McClintock Matthew-B29882
<B29882@freescale.com> wrote:
>> I read somewhere (very informative - I know - but I've forgot where)
>> that you are not supposed to include config.h for CC_FOR_BUILD
>> targets? I'm not expert and just double checking on this bit as the
>> correct solution.
>
> Found it: http://sources.redhat.com/autobook/autobook/autobook_270.html

That is a very good point, hadn't thought of that (and I recommend
that book to everyone, clearly I should re-read it).

The best fix is to just #define _GNU_SOURCE at the top of makekeys
then, and push that upstream (mail patch to xorg-devel@lists.x.org).

Ross
Daniel Stone - Sept. 25, 2012, 11:11 p.m.
Hi,

On 26 September 2012 05:09, Burton, Ross <ross.burton@intel.com> wrote:
> On 25 September 2012 19:55, McClintock Matthew-B29882
> <B29882@freescale.com> wrote:
>>> I read somewhere (very informative - I know - but I've forgot where)
>>> that you are not supposed to include config.h for CC_FOR_BUILD
>>> targets? I'm not expert and just double checking on this bit as the
>>> correct solution.
>>
>> Found it: http://sources.redhat.com/autobook/autobook/autobook_270.html
>
> That is a very good point, hadn't thought of that (and I recommend
> that book to everyone, clearly I should re-read it).
>
> The best fix is to just #define _GNU_SOURCE at the top of makekeys
> then, and push that upstream (mail patch to xorg-devel@lists.x.org).

Actually, it isn't, as that breaks non-glibc badly.  glibc takes
_GNU_SOURCE to mean 'please add useful GNU extensions to this POSIX
wasteland', whereas BSD and/or Solaris take it to mean 'please make
this only GNU and don't use any other extensions at all'.  So we have
to do whatever AC_USE_SYSTEM_EXTENSIONS does, because that really is
the only thing that actually works.

Cheers,
Daniel
Ross Burton - Sept. 26, 2012, 9:30 a.m.
On 26 September 2012 00:11, Daniel Stone <daniel@fooishbar.org> wrote:
>> The best fix is to just #define _GNU_SOURCE at the top of makekeys
>> then, and push that upstream (mail patch to xorg-devel@lists.x.org).
>
> Actually, it isn't, as that breaks non-glibc badly.  glibc takes
> _GNU_SOURCE to mean 'please add useful GNU extensions to this POSIX
> wasteland', whereas BSD and/or Solaris take it to mean 'please make
> this only GNU and don't use any other extensions at all'.  So we have
> to do whatever AC_USE_SYSTEM_EXTENSIONS does, because that really is
> the only thing that actually works.

What do you mean non-glibc? :)

Ignoring Minix as a build host (I think that's reasonable),
AC_USE_SYSTEM_EXTENSIONS  defines _ALL_SOURCE _GNU_SOURCE
_POSIX_PTHREAD_SEMANTICS _TANDEM_SOURCE, and does a compile-time
sanity test of __EXTENSIONS__ (because it's possible that some
combination of these defines make the system headers unusable on
Solaris).

This is annoying.  How about for oe-core we patch in -D_GNU_SOURCE to
src/util/Makefile.am's CPPFLAGS definition and I'll discuss with
xorg-dev for a proper fix?

Ross
McClintock Matthew-B29882 - Sept. 26, 2012, 5:55 p.m.
On Wed, Sep 26, 2012 at 4:30 AM, Burton, Ross <ross.burton@intel.com> wrote:
> On 26 September 2012 00:11, Daniel Stone <daniel@fooishbar.org> wrote:
>>> The best fix is to just #define _GNU_SOURCE at the top of makekeys
>>> then, and push that upstream (mail patch to xorg-devel@lists.x.org).
>>
>> Actually, it isn't, as that breaks non-glibc badly.  glibc takes
>> _GNU_SOURCE to mean 'please add useful GNU extensions to this POSIX
>> wasteland', whereas BSD and/or Solaris take it to mean 'please make
>> this only GNU and don't use any other extensions at all'.  So we have
>> to do whatever AC_USE_SYSTEM_EXTENSIONS does, because that really is
>> the only thing that actually works.
>
> What do you mean non-glibc? :)
>
> Ignoring Minix as a build host (I think that's reasonable),
> AC_USE_SYSTEM_EXTENSIONS  defines _ALL_SOURCE _GNU_SOURCE
> _POSIX_PTHREAD_SEMANTICS _TANDEM_SOURCE, and does a compile-time
> sanity test of __EXTENSIONS__ (because it's possible that some
> combination of these defines make the system headers unusable on
> Solaris).
>
> This is annoying.  How about for oe-core we patch in -D_GNU_SOURCE to
> src/util/Makefile.am's CPPFLAGS definition and I'll discuss with
> xorg-dev for a proper fix?

Would this be OK for now in libx11.inc?

-export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
+export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS} -D_GNU_SOURCE"

-M

Patch

diff --git a/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
new file mode 100644
index 0000000..08ba39a
--- /dev/null
+++ b/meta/recipes-graphics/xorg-lib/libx11/use_host_cc_for_utils.patch
@@ -0,0 +1,12 @@ 
+Index: libX11-1.5.0/src/Makefile.am
+===================================================================
+--- libX11-1.5.0.orig/src/Makefile.am
++++ libX11-1.5.0/src/Makefile.am
+@@ -420,6 +420,6 @@ ks_tables.h: $(KEYSYMDEFS) $(top_builddi
+ 	mv ks_tables_h $@
+ 
+ $(top_builddir)/src/util/makekeys$(EXEEXT): force
+-	cd util && $(MAKE)
++	cd util && $(MAKE) CC=gcc CCLD=gcc LDFLAGS= CFLAGS=-D_GNU_SOURCE
+ 
+ force:
diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
index 94e2051..3e00dd8 100644
--- a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
+++ b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
@@ -1,11 +1,12 @@ 
 require libx11.inc
 inherit gettext
 
-PR = "${INC_PR}.2"
+PR = "${INC_PR}.3"
 
 BBCLASSEXTEND = "native nativesdk"
 
 SRC_URI += "file://keysymdef_include.patch"
+SRC_URI_append_virtclass-nativesdk += "file://use_host_cc_for_utils.patch"
 
 SRC_URI[md5sum] = "78b4b3bab4acbdf0abcfca30a8c70cc6"
 SRC_URI[sha256sum] = "c382efd7e92bfc3cef39a4b7f1ecf2744ba4414a705e3bc1e697f75502bd4d86"