Patchwork [1/5] matchbox-stroke: Fix linking error with gold

login
register
mail settings
Submitter Khem Raj
Date Nov. 20, 2011, 5:50 p.m.
Message ID <d06edef859ff936294d76bc07523f50eaaa5baf4.1321811216.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/15159/
State New
Headers show

Comments

Khem Raj - Nov. 20, 2011, 5:50 p.m.
Gold defaults to no-add-needed thetefore
it does not link with librtaries that are not on cmdline
it needs libXrender but is not on the linker cmdline
so add it.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../matchbox-stroke/files/ldadd_libXrender.patch   |   25 ++++++++++++++++++++
 .../matchbox-stroke/matchbox-stroke_git.bb         |    6 +++-
 2 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
Richard Purdie - Nov. 22, 2011, 4:28 p.m.
On Sun, 2011-11-20 at 09:50 -0800, Khem Raj wrote:
> Gold defaults to no-add-needed thetefore
> it does not link with librtaries that are not on cmdline
> it needs libXrender but is not on the linker cmdline
> so add it.
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  .../matchbox-stroke/files/ldadd_libXrender.patch   |   25 ++++++++++++++++++++
>  .../matchbox-stroke/matchbox-stroke_git.bb         |    6 +++-
>  2 files changed, 29 insertions(+), 2 deletions(-)
>  create mode 100644 meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
> 
> diff --git a/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
> new file mode 100644
> index 0000000..90d2057
> --- /dev/null
> +++ b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
> @@ -0,0 +1,25 @@
> +with GNU binutils-gold the
> +important difference is that --no-add-needed is the default behavior of GNU
> +binutils-gold. Please provide all needed libraries to the linker when building
> +your executables.
> +
> +Otherwise we get link errors like
> +
> +/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.6.2/ld: matchbox-stroke-ui.o: in function mb_stroke_ui_resources_create:matchbox-stroke-ui.c:223: error: undefined reference to 'XRenderCreatePicture'collect2: ld returned 1 exit statusmake[2]: *** [matchbox-stroke] Error 1
> +
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +
> +Upstream-Status: Pending
> +Index: git/src/Makefile.am
> +===================================================================
> +--- git.orig/src/Makefile.am	2011-10-22 19:25:52.000000000 -0700
> ++++ git/src/Makefile.am	2011-10-22 19:27:07.746428946 -0700
> +@@ -6,7 +6,7 @@
> + 
> + bin_PROGRAMS = matchbox-stroke
> + 
> +-matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm
> ++matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm -lXrender
> + 

I had a look at this and -lXrender is listed in MBSTROKE_LIBS. I'm
therefore a little puzzled on why this patch is needed? I appreciate the
commandline is order sensitive but that order should work?

Cheers,

Richard
Khem Raj - Nov. 23, 2011, 3 a.m.
On Tue, Nov 22, 2011 at 8:28 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Sun, 2011-11-20 at 09:50 -0800, Khem Raj wrote:
>> Gold defaults to no-add-needed thetefore
>> it does not link with librtaries that are not on cmdline
>> it needs libXrender but is not on the linker cmdline
>> so add it.
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  .../matchbox-stroke/files/ldadd_libXrender.patch   |   25 ++++++++++++++++++++
>>  .../matchbox-stroke/matchbox-stroke_git.bb         |    6 +++-
>>  2 files changed, 29 insertions(+), 2 deletions(-)
>>  create mode 100644 meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
>>
>> diff --git a/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
>> new file mode 100644
>> index 0000000..90d2057
>> --- /dev/null
>> +++ b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
>> @@ -0,0 +1,25 @@
>> +with GNU binutils-gold the
>> +important difference is that --no-add-needed is the default behavior of GNU
>> +binutils-gold. Please provide all needed libraries to the linker when building
>> +your executables.
>> +
>> +Otherwise we get link errors like
>> +
>> +/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.6.2/ld: matchbox-stroke-ui.o: in function mb_stroke_ui_resources_create:matchbox-stroke-ui.c:223: error: undefined reference to 'XRenderCreatePicture'collect2: ld returned 1 exit statusmake[2]: *** [matchbox-stroke] Error 1
>> +
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> +
>> +Upstream-Status: Pending
>> +Index: git/src/Makefile.am
>> +===================================================================
>> +--- git.orig/src/Makefile.am 2011-10-22 19:25:52.000000000 -0700
>> ++++ git/src/Makefile.am      2011-10-22 19:27:07.746428946 -0700
>> +@@ -6,7 +6,7 @@
>> +
>> + bin_PROGRAMS = matchbox-stroke
>> +
>> +-matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm
>> ++matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm -lXrender
>> +
>
> I had a look at this and -lXrender is listed in MBSTROKE_LIBS. I'm
> therefore a little puzzled on why this patch is needed? I appreciate the
> commandline is order sensitive but that order should work?

In my case

Makefile:MBSTROKE_LIBS = -lXft -lX11 -lXtst -lfakekey


>
> Cheers,
>
> Richard
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Richard Purdie - Nov. 23, 2011, 12:31 p.m.
On Tue, 2011-11-22 at 19:00 -0800, Khem Raj wrote:
> On Tue, Nov 22, 2011 at 8:28 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Sun, 2011-11-20 at 09:50 -0800, Khem Raj wrote:
> >> Gold defaults to no-add-needed thetefore
> >> it does not link with librtaries that are not on cmdline
> >> it needs libXrender but is not on the linker cmdline
> >> so add it.
> >>
> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> ---
> >>  .../matchbox-stroke/files/ldadd_libXrender.patch   |   25 ++++++++++++++++++++
> >>  .../matchbox-stroke/matchbox-stroke_git.bb         |    6 +++-
> >>  2 files changed, 29 insertions(+), 2 deletions(-)
> >>  create mode 100644 meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
> >>
> >> diff --git a/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
> >> new file mode 100644
> >> index 0000000..90d2057
> >> --- /dev/null
> >> +++ b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
> >> @@ -0,0 +1,25 @@
> >> +with GNU binutils-gold the
> >> +important difference is that --no-add-needed is the default behavior of GNU
> >> +binutils-gold. Please provide all needed libraries to the linker when building
> >> +your executables.
> >> +
> >> +Otherwise we get link errors like
> >> +
> >> +/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.6.2/ld: matchbox-stroke-ui.o: in function mb_stroke_ui_resources_create:matchbox-stroke-ui.c:223: error: undefined reference to 'XRenderCreatePicture'collect2: ld returned 1 exit statusmake[2]: *** [matchbox-stroke] Error 1
> >> +
> >> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> +
> >> +Upstream-Status: Pending
> >> +Index: git/src/Makefile.am
> >> +===================================================================
> >> +--- git.orig/src/Makefile.am 2011-10-22 19:25:52.000000000 -0700
> >> ++++ git/src/Makefile.am      2011-10-22 19:27:07.746428946 -0700
> >> +@@ -6,7 +6,7 @@
> >> +
> >> + bin_PROGRAMS = matchbox-stroke
> >> +
> >> +-matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm
> >> ++matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm -lXrender
> >> +
> >
> > I had a look at this and -lXrender is listed in MBSTROKE_LIBS. I'm
> > therefore a little puzzled on why this patch is needed? I appreciate the
> > commandline is order sensitive but that order should work?
> 
> In my case
> 
> Makefile:MBSTROKE_LIBS = -lXft -lX11 -lXtst -lfakekey

I can now see why I'm confused:

http://git.yoctoproject.org/cgit.cgi/matchbox-stroke/commit/?id=2b772583b61d2f6e8358e7c80e10293fc27cfcb7

We need to update the SRCREV. I'll push something to take care of this.

Cheers,

Richard

Patch

diff --git a/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
new file mode 100644
index 0000000..90d2057
--- /dev/null
+++ b/meta/recipes-sato/matchbox-stroke/files/ldadd_libXrender.patch
@@ -0,0 +1,25 @@ 
+with GNU binutils-gold the
+important difference is that --no-add-needed is the default behavior of GNU
+binutils-gold. Please provide all needed libraries to the linker when building
+your executables.
+
+Otherwise we get link errors like
+
+/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.6.2/ld: matchbox-stroke-ui.o: in function mb_stroke_ui_resources_create:matchbox-stroke-ui.c:223: error: undefined reference to 'XRenderCreatePicture'collect2: ld returned 1 exit statusmake[2]: *** [matchbox-stroke] Error 1
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: git/src/Makefile.am
+===================================================================
+--- git.orig/src/Makefile.am	2011-10-22 19:25:52.000000000 -0700
++++ git/src/Makefile.am	2011-10-22 19:27:07.746428946 -0700
+@@ -6,7 +6,7 @@
+ 
+ bin_PROGRAMS = matchbox-stroke
+ 
+-matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm
++matchbox_stroke_LDADD = $(MBSTROKE_LIBS) $(EXPAT_LIBS) -lm -lXrender
+ 
+ matchbox_stroke_SOURCES =                                          \
+        matchbox-stroke.h                                           \
diff --git a/meta/recipes-sato/matchbox-stroke/matchbox-stroke_git.bb b/meta/recipes-sato/matchbox-stroke/matchbox-stroke_git.bb
index 44b316d..2c2e940 100644
--- a/meta/recipes-sato/matchbox-stroke/matchbox-stroke_git.bb
+++ b/meta/recipes-sato/matchbox-stroke/matchbox-stroke_git.bb
@@ -9,11 +9,13 @@  DEPENDS = "libfakekey expat libxft"
 SECTION = "x11/wm"
 SRCREV = "8edfd9a2bf1f0d6b28d4afee4bda9d3635f26a0b"
 PV = "0.0+git${SRCPV}"
-PR = "r0"
+PR = "r1"
 
 SRC_URI = "git://git.yoctoproject.org/${BPN};protocol=git \
            file://single-instance.patch \
-           file://configure_fix.patch;maxrev=1819"
+           file://configure_fix.patch;maxrev=1819 \
+           file://ldadd_libXrender.patch \
+          "
 
 S = "${WORKDIR}/git"