Skip to contentSkip to conversation

parted: fix static link (branch yem/for-release)

PATCH New Yann E. MORIN 2 participants 5 messages Nov 30, 2014

lore
Share & tools
lore
#0 lore raw

v2 cover parted: fix static link (branch yem/for-release)

Hello All!

This series fixes static linking in parted.

It needs fixes in two packages:
- util-linux, so libuuid properly sets its .pc file;
- parted itself to use pkg-config to find libuuid instead of AC_CHECK_LIB.

Changes v1 -> v2:
- add description to parted patch (Peter)
- misc typoes (Baruch, Peter)

Regards,
Yann E. MORIN.

The following changes since commit b68b6eca4c7c7895cd9d1a17761fdc3a835a6be7:

package/libwebsockets: fix static build (2014-11-30 12:43:33 +0100)

are available in the git repository at:

git://git.busybox.net/~ymorin/git/buildroot yem/for-release

for you to fetch changes up to fa1b00debbe3293a7617c2c7829e9acead92dc19:

package/parted: fix static link (2014-11-30 14:59:24 +0100)

----------------------------------------------------------------
Yann E. MORIN (2):
package/util-linux: libuuid needs -lintl
package/parted: fix static link

 .../parted/parted-003-fix-static-link-uuid.patch   | 48 ++++++++++++++++++++++
 package/util-linux/util-linux.mk                   |  8 ++++
 2 files changed, 56 insertions(+)
 create mode 100644 package/parted/parted-003-fix-static-link-uuid.patch
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/2 package/util-linux: libuuid needs -lintl

When gettext is needed (with locales), libuuid needs to be linked against -lintl.

In dynamic link, this is solved via the DT_NEEDED ELF tag, but for static links, it does not get pulled in automatically.

Fix that by adding a Libs.private section to uuid.pc, but only if it needed.

First part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Cc Thomas Petazzoni <[email protected]>
Cc Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- typo (Baruch)

---
 package/util-linux/util-linux.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/util-linux/util-linux.mk +8 -0
index 6ecd16d..dc10193 100644
@@ -128,6 +128,14 @@ endif
 
 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
 
+ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
+define UTIL_LINUX_TWEAK_UUID_PC
+	$(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
+	printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
+endef
+UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/2 package/util-linux: libuuid needs -lintl

Quoted 30 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

When gettext is needed (with locales), libuuid needs to be linked against -lintl.

In dynamic link, this is solved via the DT_NEEDED ELF tag, but for static links, it does not get pulled in automatically.

Fix that by adding a Libs.private section to uuid.pc, but only if it needed.

First part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Cc Thomas Petazzoni <[email protected]>
Cc Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- typo (Baruch)

---
 package/util-linux/util-linux.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/util-linux/util-linux.mk +0 -0
index 6ecd16d..dc10193 100644

package/util-linux/util-linux.mk endif · line 135

Quoted 8 lines
package/util-linux/util-linux.mk +5 -0
@@ -128,6 +128,14 @@ endif
 
 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
 
+ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE)$(BR2_PACKAGE_UTIL_LINUX_LIBUUID),yy)
+define UTIL_LINUX_TWEAK_UUID_PC
+	$(SED) '/Libs\.private: .*/d' $(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
+	printf "Libs.private: -lintl\n" >>$(STAGING_DIR)/usr/lib/pkgconfig/uuid.pc
+endef

As discussed on IRC, I don't think the SED line is needed - But lets leave it here to be on the safe side.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v2 2/2 package/parted: fix static link

In reply to Yann E. MORIN

libuuid needs to be linked with -lintl when gettext is needed (with locales).

For a shared build, this is solved with the DT_NEEDED ELF tags, but for a static link, it is not pulled in automatically.

Use pkg-config to find libuuid, instead of AC_CHECK_LIB().

Second part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Cc Thomas Petazzoni <[email protected]>
Cc Peter Korsgaard <[email protected]>

---
Changes v1 -> v2:
- typoes (Peter)

---
 .../parted/parted-003-fix-static-link-uuid.patch   | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 package/parted/parted-003-fix-static-link-uuid.patch
package/parted/parted-003-fix-static-link-uuid.patch new file +48 -0
new file mode 100644
index 0000000..d6ec2cf
@@ -0,0 +1,48 @@
+configure: use pkg-config to find libuuid
+
+In some conditions, libuuid may be linked with -lintl. This can be the
+case on uClibc when locales are enabled.
+
+When doing a shared link, this dependency is automatically pulled in via
+a DT_NEEDED ELF tag
+
+For a static link, there is no such mechanism to pull in dependent
+libraries.
+
+Currently, the check for libuuid is done with AC_CHECK_LIB, but this
+does not handle dependencies, and thus a stattic build fails.
+
+Use pkg-config to find libuuid, that automatically pulls in the
+dependencies of libuuid, if any.
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+
+---
+Note: of course, that relies on the fact that libuuid installs a proper
+.pc file; a patch will be submitted upstream shortly.
+
+But even considering the current situation, where libuuid does not
+provide a proper .pc file (yet), this patch does not change the
+behaviour we've had so far; it is a bet on the future! ;-)
+
+diff -durN parted-3.1.orig/configure.ac parted-3.1/configure.ac
+--- parted-3.1.orig/configure.ac	2014-11-29 16:27:49.520560137 +0100
++++ parted-3.1/configure.ac	2014-11-29 16:32:50.799702049 +0100
+@@ -313,16 +313,7 @@
+ AC_SUBST([DL_LIBS])
+ 
+ dnl Check for libuuid
+-UUID_LIBS=""
+-AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS="-luuid"],
+-	[AC_MSG_ERROR(dnl
+-[GNU Parted requires libuuid - a part of the util-linux-ng package (but
+-usually distributed separately in libuuid-devel, uuid-dev or similar)
+-This can probably be found on your distribution's CD or FTP site or at:
+-    http://userweb.kernel.org/~kzak/util-linux-ng/
+-Note: originally, libuuid was part of the e2fsprogs package.  Later, it
+-moved to util-linux-ng-2.16, and that package is now the preferred source.])])
+-AC_SUBST([UUID_LIBS])
++PKG_CHECK_MODULES([UUID],[uuid])
+ 
+ dnl Check for libdevmapper
+ DM_LIBS=
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 2/2 package/parted: fix static link

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

libuuid needs to be linked with -lintl when gettext is needed (with locales).

For a shared build, this is solved with the DT_NEEDED ELF tags, but for a static link, it is not pulled in automatically.

Use pkg-config to find libuuid, instead of AC_CHECK_LIB().

Second part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Quoted 7 lines
Cc Thomas Petazzoni <[email protected]>
Cc Peter Korsgaard <[email protected]>

---
Changes v1 -> v2:
- typoes (Peter)

You forgot to add host-pkgconf to the _DEPENDENCIES lines (target/host). Committed with that fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard