Skip to contentSkip to conversation

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

PATCH Superseded Yann E. MORIN 3 participants 8 messages Nov 29, 2014 – Nov 30, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

Hello All!

This seriesis an RFC to fix building parted in static links.

I have no good idea on how to properly fix the libuuid .pc file, so I did it iwth a conditional post-install hook. I'm sure this is not the best option, but I can't think of anything better (yet).

Of course, the parted patch is dependent on the preceding util-linux patch, but can still be applied without it, because at worst it would leave us in the same situation as we ar today.

Still, this is just an RFC to see what you guys think about it.

Regards,
Yann E. MORIN.

The following changes since commit fcd082a0c3f78381ecdf41d487405434fabd09b0:

package/libwebsockets: fiux static build (2014-11-29 15:47:28 +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 4431396aaa3e810c5ef599e341858e8849d530e1:

package/parted: fix static link (2014-11-29 16:57:56 +0100)

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

 .../parted/parted-003-fix-static-link-uuid.patch    | 21 +++++++++++++++++++++
 package/util-linux/util-linux.mk                    |  8 ++++++++
 2 files changed, 29 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 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 uid.pc, but only if it needed.

First part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Cc Thomas Petazzoni <[email protected]>
---
 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 1/2 package/util-linux: libuuid needs -lintl

Hi Yann,

Quoted 7 lines · Yann E. MORIN

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 uid.pc, but only if

s/uid/uuid/

baruch

Quoted 29 lines

it needed.

First part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Cc Thomas Petazzoni <[email protected]>
---
 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 · 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 -
#3 lore raw

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

Baruch, All,

On 2014-11-29 20:04 +0200, Baruch Siach spake thusly:

Quoted 10 lines · Yann E. MORIN
Quoted 7 lines

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 uid.pc, but only if

s/uid/uuid/

Fixed, thanks!

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

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

In reply to Yann E. MORIN

Thomas, Peter, All,

On 2014-11-29 16:59 +0100, Yann E. MORIN spake thusly:

Quoted 23 lines

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 uid.pc, but only if it needed.

First part at fixing:

    http://autobuild.buildroot.net/results/c46/c467aeec258909bb82eda77123803944f97d8df8/
Cc Thomas Petazzoni <[email protected]>
---
 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 137

Quoted 10 lines
package/util-linux/util-linux.mk +7 -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
+UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_TWEAK_UUID_PC
+endif

We've been discussing this on IRC, that we should come up with a patch that could be upstreamable. Unfortunately, I have no idea on how to do that...

It all boils down to util-linux not using the standard expansion mechanism of autoconf (i.e. to replace @VARIABLE@ in .in files with the value detected by ./configure).

Also, the way they are checking for gettext is way beyond my understanding (well, I think I grasped most of it), and they have no variable that expressly states whether -lintl is needed, just a LIBINTL variable that contains whatever must be used to link with the gettext-providing library.

The amount of work to fix that is way above the time left before our release, so I believe we should go with that patch for now, and revisit it later when we have some more time.

Opinions?

Quoted 6 lines
package/util-linux/util-linux.mk +0 -0
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
 
Signature · 1 line
1.9.1
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.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 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 static 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]>
---
 .../parted/parted-003-fix-static-link-uuid.patch    | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 package/parted/parted-003-fix-static-link-uuid.patch
package/parted/parted-003-fix-static-link-uuid.patch new file +21 -0
new file mode 100644
index 0000000..e281b6f
@@ -0,0 +1,21 @@
+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
#6 lore raw

PATCH 2/2 package/parted: fix static link

Quoted 6 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 static build, this is solved with the DT_NEEDED ELF tags, but for

s/static/shared/

package/parted/parted-003-fix-static-link-uuid.patch

Quoted 20 lines

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]>
---
 .../parted/parted-003-fix-static-link-uuid.patch    | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 package/parted/parted-003-fix-static-link-uuid.patch
package/parted/parted-003-fix-static-link-uuid.patch new file +0 -0
new file mode 100644
index 0000000..e281b6f
@@ -0,0 +1,21 @@

You forgot the patch description + signed-off-by.

Otherwise it looks good. Please don't forget to send it upstream.

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

PATCH 2/2 package/parted: fix static link

Peter, All,

On 2014-11-29 17:56 +0100, Peter Korsgaard spake thusly:

Quoted 8 lines
Quoted 6 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 static build, this is solved with the DT_NEEDED ELF tags, but for

s/static/shared/

Yup, onviously. Fixed, thanks.

Quoted 14 lines
Quoted 13 lines

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]>
---
 .../parted/parted-003-fix-static-link-uuid.patch    | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 package/parted/parted-003-fix-static-link-uuid.patch
Quoted 8 lines

package/parted/parted-003-fix-static-link-uuid.patch

Quoted 6 lines
package/parted/parted-003-fix-static-link-uuid.patch new file +0 -0
new file mode 100644
index 0000000..e281b6f
@@ -0,0 +1,21 @@

You forgot the patch description + signed-off-by.

Damn, I knew something was amiss in that submission.

If all that is incorrect is the patch description and a missing SoB, then that's cool. I was expecting that series to be more controversial.

I'll respin those two a bit later. Thanks! :-)

Quoted 1 line

Otherwise it looks good. Please don't forget to send it upstream.

Yep, I'm actively pushing things upstream when it makes sense. ;-)

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'