All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue
@ 2016-12-08 17:23 Waldemar Brodkorb
  2016-12-08 21:06 ` Thomas Petazzoni
  2016-12-10 15:00 ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Waldemar Brodkorb @ 2016-12-08 17:23 UTC (permalink / raw)
  To: buildroot

LDFLAGS must be passed when creating binaries.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 .../sdl_mixer/0002-add-LDFLAGS-while-linking.patch | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 package/sdl_mixer/0002-add-LDFLAGS-while-linking.patch

diff --git a/package/sdl_mixer/0002-add-LDFLAGS-while-linking.patch b/package/sdl_mixer/0002-add-LDFLAGS-while-linking.patch
new file mode 100644
index 0000000..4144660
--- /dev/null
+++ b/package/sdl_mixer/0002-add-LDFLAGS-while-linking.patch
@@ -0,0 +1,29 @@
+Pass LDFLAGS while creating binaries.
+
+Fixes following linking error with uClibc-ng:
+br/output/host/usr/lib/gcc/powerpc-buildroot-linux-uclibc/5.4.0/libgcc.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE':
+br/output/build/host-gcc-final-5.4.0/build/powerpc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:465: undefined reference to `dl_iterate_phdr'
+collect2: error: ld returned 1 exit status
+
+Since uClibc-ng 1.0.18 a circular dependency between libc and libgcc
+exist, when static linking is used. It can be resolved by the compiler
+when -static is correctly passed in the linking step.
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur SDL_mixer-1.2.12.orig/Makefile.in SDL_mixer-1.2.12/Makefile.in
+--- SDL_mixer-1.2.12.orig/Makefile.in	2012-01-15 23:01:04.000000000 +0100
++++ SDL_mixer-1.2.12/Makefile.in	2016-12-07 08:29:22.479786596 +0100
+@@ -66,10 +66,10 @@
+ 	$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
+ 
+ $(objects)/playwave$(EXE): $(objects)/playwave.lo $(objects)/$(TARGET)
+-	$(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET)
++	$(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(LDFLAGS) $(objects)/$(TARGET)
+ 
+ $(objects)/playmus$(EXE): $(objects)/playmus.lo $(objects)/$(TARGET)
+-	$(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET)
++	$(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(LDFLAGS) $(objects)/$(TARGET)
+ 
+ install: all install-hdrs install-lib #install-bin
+ install-hdrs:
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue
  2016-12-08 17:23 [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue Waldemar Brodkorb
@ 2016-12-08 21:06 ` Thomas Petazzoni
  2016-12-09  4:27   ` Waldemar Brodkorb
  2016-12-10 15:00 ` Thomas Petazzoni
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2016-12-08 21:06 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 8 Dec 2016 18:23:31 +0100, Waldemar Brodkorb wrote:

> +Pass LDFLAGS while creating binaries.
> +
> +Fixes following linking error with uClibc-ng:
> +br/output/host/usr/lib/gcc/powerpc-buildroot-linux-uclibc/5.4.0/libgcc.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE':
> +br/output/build/host-gcc-final-5.4.0/build/powerpc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:465: undefined reference to `dl_iterate_phdr'
> +collect2: error: ld returned 1 exit status
> +
> +Since uClibc-ng 1.0.18 a circular dependency between libc and libgcc
> +exist, when static linking is used. It can be resolved by the compiler
> +when -static is correctly passed in the linking step.

musl is also using a "everything in libc" policy. Does this problem
also occurs with musl? If not, why?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue
  2016-12-08 21:06 ` Thomas Petazzoni
@ 2016-12-09  4:27   ` Waldemar Brodkorb
  2016-12-09  9:55     ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Waldemar Brodkorb @ 2016-12-09  4:27 UTC (permalink / raw)
  To: buildroot

Hi,
Thomas Petazzoni wrote,

> Hello,
> 
> On Thu, 8 Dec 2016 18:23:31 +0100, Waldemar Brodkorb wrote:
> 
> > +Pass LDFLAGS while creating binaries.
> > +
> > +Fixes following linking error with uClibc-ng:
> > +br/output/host/usr/lib/gcc/powerpc-buildroot-linux-uclibc/5.4.0/libgcc.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE':
> > +br/output/build/host-gcc-final-5.4.0/build/powerpc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:465: undefined reference to `dl_iterate_phdr'
> > +collect2: error: ld returned 1 exit status
> > +
> > +Since uClibc-ng 1.0.18 a circular dependency between libc and libgcc
> > +exist, when static linking is used. It can be resolved by the compiler
> > +when -static is correctly passed in the linking step.
> 
> musl is also using a "everything in libc" policy. Does this problem
> also occurs with musl? If not, why?

It does not happen with musl because musl does not use libgcc
unwinding functionality for pthread_cancel implementation.
If anyone want to hack on uClibc-ng, I would love to get the libgcc
dependency out. Old linuxthreads didn't use it, so this would
be a good starting point to look at :)

If you would allow to use glibc for static linking, which is
technically possible, you would see the same issue.

best regards
 Waldemar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue
  2016-12-09  4:27   ` Waldemar Brodkorb
@ 2016-12-09  9:55     ` Thomas Petazzoni
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2016-12-09  9:55 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 9 Dec 2016 05:27:18 +0100, Waldemar Brodkorb wrote:

> > musl is also using a "everything in libc" policy. Does this problem
> > also occurs with musl? If not, why?  
> 
> It does not happen with musl because musl does not use libgcc
> unwinding functionality for pthread_cancel implementation.
> If anyone want to hack on uClibc-ng, I would love to get the libgcc
> dependency out. Old linuxthreads didn't use it, so this would
> be a good starting point to look at :)
> 
> If you would allow to use glibc for static linking, which is
> technically possible, you would see the same issue.

OK. Thanks a lot for this explanation. This clarifies why we're seeing
this with uClibc-ng only, which is what I wanted to understand.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue
  2016-12-08 17:23 [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue Waldemar Brodkorb
  2016-12-08 21:06 ` Thomas Petazzoni
@ 2016-12-10 15:00 ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2016-12-10 15:00 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 8 Dec 2016 18:23:31 +0100, Waldemar Brodkorb wrote:
> LDFLAGS must be passed when creating binaries.
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> ---
>  .../sdl_mixer/0002-add-LDFLAGS-while-linking.patch | 29 ++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 package/sdl_mixer/0002-add-LDFLAGS-while-linking.patch

Applied to master, thanks. Please submit the patch upstream. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-10 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 17:23 [Buildroot] [PATCH v2] sdl_mixer: fix static linking issue Waldemar Brodkorb
2016-12-08 21:06 ` Thomas Petazzoni
2016-12-09  4:27   ` Waldemar Brodkorb
2016-12-09  9:55     ` Thomas Petazzoni
2016-12-10 15:00 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.