Skip to contentSkip to conversation

pixiewps: fix static linking with uclibc-ng

PATCH Superseded Fabrice Fontaine 3 participants 5 messages Jun 9, 2018 – Jun 10, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pixiewps: fix static linking with uclibc-ng

Fixes following linking error with uClibc-ng:
/home/peko/autobuild/instance-0/output/host/lib/gcc/powerpc-buildroot-linux-uclibc/7.3.0/libgcc.a(unwind-dw2-fde-dip.o):
In function `_Unwind_Find_FDE':
/home/peko/autobuild/instance-0/output/build/host-gcc-final-7.3.0/build/powerpc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:469:
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.

So rework a little bit how variables are passed by using PIXIEWPS_MAKE_OPTS and TARGET_CONFIGURE_OPTS

Fixes:
- http://autobuild.buildroot.net/results/d9f0311538c8db1196839e36af3f6ef4e403be2b

---
 package/pixiewps/pixiewps.mk | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
package/pixiewps/pixiewps.mk +7 -3
index 95a253ab83..56d15a0bbf 100644
@@ -9,13 +9,17 @@ PIXIEWPS_SITE = $(call github,wiire-a,pixiewps,$(PIXIEWPS_VERSION))
 PIXIEWPS_LICENSE = GPL-3.0+
 PIXIEWPS_LICENSE_FILES = LICENSE.md
 
+PIXIEWPS_MAKE_OPTS = \
+	$(TARGET_CONFIGURE_OPTS) \
+	PREFIX=/usr
+
 define PIXIEWPS_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) CC=$(TARGET_CC) -C $(@D)
+	$(TARGET_MAKE_ENV) $(MAKE) $(PIXIEWPS_MAKE_OPTS) -C $(@D)
 endef
 
 define PIXIEWPS_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) \
-		PREFIX=/usr -C $(@D) install
+	$(TARGET_MAKE_ENV) $(MAKE) $(PIXIEWPS_MAKE_OPTS) -C $(@D) \
+		DESTDIR=$(TARGET_DIR) install
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 pixiewps: fix static linking with uclibc-ng

Hi Fabrice, Thomas,

Quoted 11 lines · Fabrice Fontaine

Fixes following linking error with uClibc-ng:
/home/peko/autobuild/instance-0/output/host/lib/gcc/powerpc-buildroot-linux-uclibc/7.3.0/libgcc.a(unwind-dw2-fde-dip.o):
In function `_Unwind_Find_FDE':
/home/peko/autobuild/instance-0/output/build/host-gcc-final-7.3.0/build/powerpc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:469:
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.

Quoted 5 lines

So rework a little bit how variables are passed by using PIXIEWPS_MAKE_OPTS and TARGET_CONFIGURE_OPTS

Fixes:
- http://autobuild.buildroot.net/results/d9f0311538c8db1196839e36af3f6ef4e403be2b

Here is an example where uClibc also requires -static, even though the toolchain is static only. So musl in not alone here, cfr. bug #10996.

This also means that the lm-sensors RFC fix is correct:

http://patchwork.ozlabs.org/patch/883243/

baruch

Quoted 31 lines
---
 package/pixiewps/pixiewps.mk | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
package/pixiewps/pixiewps.mk +7 -3
index 95a253ab83..56d15a0bbf 100644
@@ -9,13 +9,17 @@ PIXIEWPS_SITE = $(call github,wiire-a,pixiewps,$(PIXIEWPS_VERSION))
 PIXIEWPS_LICENSE = GPL-3.0+
 PIXIEWPS_LICENSE_FILES = LICENSE.md
 
+PIXIEWPS_MAKE_OPTS = \
+	$(TARGET_CONFIGURE_OPTS) \
+	PREFIX=/usr
+
 define PIXIEWPS_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) CC=$(TARGET_CC) -C $(@D)
+	$(TARGET_MAKE_ENV) $(MAKE) $(PIXIEWPS_MAKE_OPTS) -C $(@D)
 endef
 
 define PIXIEWPS_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) \
-		PREFIX=/usr -C $(@D) install
+	$(TARGET_MAKE_ENV) $(MAKE) $(PIXIEWPS_MAKE_OPTS) -C $(@D) \
+		DESTDIR=$(TARGET_DIR) install
 endef
 
 $(eval $(generic-package))
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 pixiewps: fix static linking with uclibc-ng

Hello,

Quoted 6 lines · Baruch Siach

Here is an example where uClibc also requires -static, even though the toolchain is static only. So musl in not alone here, cfr. bug #10996.

This also means that the lm-sensors RFC fix is correct:

http://patchwork.ozlabs.org/patch/883243/

Regarding this, I asked on the musl mailing list, and the conclusion I got from the discussion was that indeed -static should be passed:

http://www.openwall.com/lists/musl/2018/05/08/1

So yes, we should add -static when the packages for some reason are not propagating this LDFLAGS.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 pixiewps: fix static linking with uclibc-ng

In reply to Fabrice Fontaine

Hello,

package/pixiewps/pixiewps.mk PIXIEWPS_SITE = $(call github,wiire-a,pixiewps,$(PIXIEWPS_VERSION)) · line 14

Quoted 3 lines · Fabrice Fontaine
package/pixiewps/pixiewps.mk +3 -0
+PIXIEWPS_MAKE_OPTS = \
+	$(TARGET_CONFIGURE_OPTS) \
+	PREFIX=/usr

Why are you introducing PIXIEWPS_MAKE_OPTS instead of using TARGET_CONFIGURE_OPTS directly ?

Indeed your change also has the consequence of passing PREFIX=/usr at build time. Is this necessary ? This seems like an unrelated change.

By the way, are you on IRC ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 pixiewps: fix static linking with uclibc-ng

Dear Thomas,

2018-06-10 15:49 GMT+02:00 Thomas Petazzoni <[email protected]>:

Quoted 11 lines

Hello,

package/pixiewps/pixiewps.mk PIXIEWPS_SITE = $(call github,wiire-a,pixiewps,$(PIXIEWPS_VERSION)) · line 14

Quoted 3 lines · Fabrice Fontaine
package/pixiewps/pixiewps.mk +3 -0
+PIXIEWPS_MAKE_OPTS = \
+     $(TARGET_CONFIGURE_OPTS) \
+     PREFIX=/usr

Why are you introducing PIXIEWPS_MAKE_OPTS instead of using TARGET_CONFIGURE_OPTS directly ?

I wanted to use this new variable to pass future options such as OPENSSL but you're right this is not needed for this fix.

Quoted 4 lines

Indeed your change also has the consequence of passing PREFIX=/usr at build time. Is this necessary ? This seems like an unrelated change.

No it's not necessary, I will send a v2 of this patch.

Quoted 3 lines

By the way, are you on IRC ?

Nope, but I can join if needed.

Quoted 9 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

Best Regards,

Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180610/d34c81bc/attachment.html>