Skip to contentSkip to conversation

mtd: fix static build with uuid

PATCH Superseded Baruch Siach 5 participants 6 messages Sep 11, 2015 – Sep 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mtd: fix static build with uuid

The uuid library might depend on gettext. Use pkg-config to discover uuid dependencies at build time, and edit Makefile accordingly to avoid missing symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc Vicente Olivert Riera <[email protected]>

---
v2:
* Use backticks instead of $(shell ...) make function (Arnout)

---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/mtd/mtd.mk +7 -1
index 0fb9fc2c1acc..89cfac15756a 100644
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
-MTD_DEPENDENCIES += util-linux zlib lzo
+MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
+define MTD_ADD_MISSING_LINTL
+	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
 endif
 
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
Signature · 1 line
2.5.1
#1 lore raw

PATCH v2 1/1 mtd: fix static build with uuid

Quoted 6 lines · Baruch Siach

The uuid library might depend on gettext. Use pkg-config to discover uuid dependencies at build time, and edit Makefile accordingly to avoid missing symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Quoted 7 lines

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc Vicente Olivert Riera <[email protected]>

by compiling the previously failed autobuild configs with this patch added

Quoted 34 lines

---
v2:
* Use backticks instead of $(shell ...) make function (Arnout)

---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/mtd/mtd.mk +7 -2
index 0fb9fc2c1acc..89cfac15756a 100644
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
-MTD_DEPENDENCIES += util-linux zlib lzo
+MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
+define MTD_ADD_MISSING_LINTL
+       $(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
 endif
 
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
--

2.5.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw

PATCH v2 1/1 mtd: fix static build with uuid

In reply to Baruch Siach

Dear Baruch Siach,

Quoted 31 lines · Baruch Siach

The uuid library might depend on gettext. Use pkg-config to discover uuid dependencies at build time, and edit Makefile accordingly to avoid missing symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc Vicente Olivert Riera <[email protected]>

---
v2:
* Use backticks instead of $(shell ...) make function (Arnout)

---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/mtd/mtd.mk +2 -0
index 0fb9fc2c1acc..89cfac15756a 100644
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+

package/mtd/mtd.mk ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y) · line 29

Quoted 10 lines
package/mtd/mtd.mk +5 -1
 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
-MTD_DEPENDENCIES += util-linux zlib lzo
+MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
+define MTD_ADD_MISSING_LINTL
+	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
 endif
 
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)

I have tested it and it works. My mistake was using / instead of % in the sed command.

Since this fails only for static, why don't you put your changes enclosed into an "ifeq ($(BR2_STATIC_LIBS),y)" clause?

ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y) MTD_DEPENDENCIES += util-linux zlib lzo
+ifeq ($(BR2_STATIC_LIBS),y)
+MTD_DEPENDENCIES += host-pkgconf +MTD_MKFSUBIFS_LIBS = $(PKG_CONFIG_HOST_BINARY) --libs uuid +define MTD_ADD_MISSING_LINTL
+ $(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%"
$(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL +endif
endif

ifeq ($(BR2_PACKAGE_BUSYBOX),y)

Regards,

Vincent.

#3 lore raw

PATCH v2 1/1 mtd: fix static build with uuid

Hi Vincent,

Quoted 40 lines · Vicente Olivert Riera
Quoted 39 lines · Baruch Siach

The uuid library might depend on gettext. Use pkg-config to discover uuid dependencies at build time, and edit Makefile accordingly to avoid missing symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc Vicente Olivert Riera <[email protected]>

---
v2:
* Use backticks instead of $(shell ...) make function (Arnout)

---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/mtd/mtd.mk +7 -1
index 0fb9fc2c1acc..89cfac15756a 100644
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
-MTD_DEPENDENCIES += util-linux zlib lzo
+MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
+define MTD_ADD_MISSING_LINTL
+	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
 endif
 
Quoted 4 lines

package/mtd/mtd.mk ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y) · line 29

Quoted 1 line
package/mtd/mtd.mk +0 -0
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)

I have tested it and it works. My mistake was using / instead of % in the sed command.

Also the use of single quotes instead of double quotes as Arnout has noted.

Quoted 2 lines

Since this fails only for static, why don't you put your changes enclosed into an "ifeq ($(BR2_STATIC_LIBS),y)" clause?

$(PKG_CONFIG_HOST_BINARY) should output the correct list of libraries for both static and dynamic builds. I think that the mtd.mk simplification and wider test coverage outweighs the added overhead. Are there any other drawbacks to running $(PKG_CONFIG_HOST_BINARY) unconditionally?

Thanks for reviewing and testing.

baruch

Quoted 14 lines

ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
MTD_DEPENDENCIES += util-linux zlib lzo

(quoted diff) +5 -0
+ifeq ($(BR2_STATIC_LIBS),y)
+MTD_DEPENDENCIES += host-pkgconf
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+define MTD_ADD_MISSING_LINTL
+       $(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%"

$(@D)/Makefile

package/mtd/mtd.mk +3 -0
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
+endif
 endif
 
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
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 -
#4 lore raw

PATCH v2 1/1 mtd: fix static build with uuid

In reply to Baruch Siach

Dear Baruch Siach,

Quoted 25 lines · Baruch Siach

The uuid library might depend on gettext. Use pkg-config to discover uuid dependencies at build time, and edit Makefile accordingly to avoid missing symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc Vicente Olivert Riera <[email protected]>

---
v2:
* Use backticks instead of $(shell ...) make function (Arnout)

---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/mtd/mtd.mk +0 -0
index 0fb9fc2c1acc..89cfac15756a 100644

package/mtd/mtd.mk ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y) · line 19

Quoted 4 lines
package/mtd/mtd.mk +1 -0
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`

Is there any reason for this definition to be outside of the BR2_PACKAGE_MTD_MKFSUBIFS=y condition? It would be more logical, and people wouldn't wonder why you're using PKG_CONFIG_HOST_BINARY outside of the condition, while host-pkgconf is only added to the dependencies inside the condition.

Also, ideally we should be patching the mtd Makefile to use pkg-config, and submit that upstream (with maybe a fallback on a default value if pkg-config is not available).

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v2 1/1 mtd: fix static build with uuid

In reply to Baruch Siach
Quoted 27 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

The uuid library might depend on gettext. Use pkg-config to discover uuid dependencies at build time, and edit Makefile accordingly to avoid missing symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc Vicente Olivert Riera <[email protected]>

---
v2:
* Use backticks instead of $(shell ...) make function (Arnout)

---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/mtd/mtd.mk +0 -0
index 0fb9fc2c1acc..89cfac15756a 100644

package/mtd/mtd.mk ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y) · line 24

Quoted 10 lines
package/mtd/mtd.mk +5 -1
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
-MTD_DEPENDENCIES += util-linux zlib lzo
+MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
+define MTD_ADD_MISSING_LINTL
+	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile

The helper variable is only used once, so I've removed it and directly added the pkg-config call here.

Committed, thanks.

With that said, it would be good to get upstream to use pkg-config directly.

Signature · 1 line
Bye, Peter Korsgaard