Skip to contentSkip to conversation

Set of fixes, for 2013.08

PATCH New Thomas Petazzoni 6 participants 13 messages Aug 20, 2013 – Sep 2, 2013 1 message not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

cover Set of fixes, for 2013.08

Hello,

Here is a small set of fixes, intended for 2013.08. Please review and provide Acked-by if appropriate, so that I can apply them afterwards.

Thanks!

Thomas

Thomas Petazzoni (5):
attr: add patch to fix static installation
acl: add patch to fix static installation
Makefile: test before search for kernel modules
Makefile: do not try to strip inexisting file when stripping
libpthread
kmod: does not support static builds

 Makefile                                           |  7 +++---
 .../acl/acl-01-support-static-installation.patch   | 29 ++++++++++++++++++++++
 .../attr/attr-01-support-static-installation.patch | 29 ++++++++++++++++++++++
 package/kmod/Config.in                             |  1 +
 package/udev/Config.in                             |  1 +
 system/Config.in                                   |  1 +
 6 files changed, 65 insertions(+), 3 deletions(-)
 create mode 100644 package/acl/acl-01-support-static-installation.patch
 create mode 100644 package/attr/attr-01-support-static-installation.patch
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/5 attr: add patch to fix static installation

When attr is built static-only, it forgets to install its libattr.a file, which leads to the build failure of packages such as 'acl' that rely on attr.

---
 .../attr/attr-01-support-static-installation.patch | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 package/attr/attr-01-support-static-installation.patch
package/attr/attr-01-support-static-installation.patch new file +29 -0
new file mode 100644
index 0000000..87858ac
@@ -0,0 +1,29 @@
+Support installation of .a file when doing static linking
+
+When doing static linking (i.e ENABLE_SHARED != yes), the attr build
+logic wasn't installing any library at all, not even the .a file which
+is needed for static linking. This patch fixes that.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Index: b/include/buildmacros
+===================================================================
+--- a/include/buildmacros
++++ b/include/buildmacros
+@@ -97,7 +97,15 @@
+ 
+ INSTALL_LTLIB_STATIC = \
+ 	cd $(TOPDIR)/$(LIBNAME)/.libs; \
+-	../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR);
++	../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
++	../$(INSTALL) -m 644 -T old_lib $(LIBNAME).la $(PKG_DEVLIB_DIR); \
++	../$(INSTALL) -m 644 $(LIBNAME).la $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
++	../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
++	../$(INSTALL) -T so_base $(LIBNAME).la $(PKG_LIB_DIR); \
++	if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
++	../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
++	../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
++	fi
+ 
+ INSTALL_MAN = \
+ 	@for d in $(MAN_PAGES); do \
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 2/5 acl: add patch to fix static installation

In reply to Thomas Petazzoni

Just like 'attr', 'acl' doesn't use automake to control the build/installation of its components, and the static-only installation process was not installing libacl.a. We add a patch that fixes this.

---
 .../acl/acl-01-support-static-installation.patch   | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 package/acl/acl-01-support-static-installation.patch
package/acl/acl-01-support-static-installation.patch new file +29 -0
new file mode 100644
index 0000000..4cb473f
@@ -0,0 +1,29 @@
+Support installation of .a file when doing static linking
+
+When doing static linking (i.e ENABLE_SHARED != yes), the acl build
+logic wasn't installing any library at all, not even the .a file which
+is needed for static linking. This patch fixes that.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Index: b/include/buildmacros
+===================================================================
+--- a/include/buildmacros
++++ b/include/buildmacros
+@@ -97,7 +97,15 @@
+ 
+ INSTALL_LTLIB_STATIC = \
+ 	cd $(TOPDIR)/$(LIBNAME)/.libs; \
+-	../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR);
++	../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
++	../$(INSTALL) -m 644 -T old_lib $(LIBNAME).la $(PKG_DEVLIB_DIR); \
++	../$(INSTALL) -m 644 $(LIBNAME).la $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
++	../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
++	../$(INSTALL) -T so_base $(LIBNAME).la $(PKG_LIB_DIR); \
++	if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
++	../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
++	../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
++	fi
+ 
+ INSTALL_MAN = \
+ 	@for d in $(MAN_PAGES); do \
Signature · 1 line
1.8.1.2
#5 lore raw

PATCH 3/5 Makefile: test before search for kernel modules

In reply to Thomas Petazzoni

The 'find $(TARGET_DIR)/lib/modules' used to find and strip kernel modules fails when no kernel modules have been installed. While the '|| true' prevents the entire build from failing, there are still some error messages displayed, which is not nice.

Instead, test if the directory exists before doing the find. We also remove the '|| true' in order to really abort the build if a problematic error occurs.

---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Makefile +3 -2
index 794d217..5d40126 100644
@@ -476,8 +476,9 @@ ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
 	find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
 endif
 	$(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
-	find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
-		xargs -r $(KSTRIPCMD) || true
+	test -d $(TARGET_DIR)/lib/modules && \
+		find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
+		xargs -r $(KSTRIPCMD)
 
 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
 # besides the one in which crash occurred; or SIGTRAP kills my program when
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH 3/5 Makefile: test before search for kernel modules

Quoted 10 lines · Thomas Petazzoni

The 'find $(TARGET_DIR)/lib/modules' used to find and strip kernel modules fails when no kernel modules have been installed. While the '|| true' prevents the entire build from failing, there are still some error messages displayed, which is not nice.

Instead, test if the directory exists before doing the find. We also remove the '|| true' in order to really abort the build if a problematic error occurs.

#7 lore raw

PATCH 4/5 Makefile: do not try to strip inexisting file when stripping libpthread

In reply to Thomas Petazzoni

libpthread.so has a special stripping condition to preserve parts of it that are needed for debugging. However, due to the usage of 'xargs' instead of 'xargs -r', the strip command is executed regardless of whether a libpthread.so file is found or not. This leads to a big error message being displayed in static-only builds, because strip is executed without a file argument. Thanks to the '|| true', the build continues, but still shows a big error message in the middle, which is not nice.

By using 'xargs -r', we avoid the strip command from being executed when 'find' doesn't find any match. We also remove the '|| true' to catch other real errors.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 5d40126..9201f27 100644
@@ -485,7 +485,7 @@ endif
 # I set a breakpoint"
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 	find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
-		xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
+		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
 endif
 
 	mkdir -p $(TARGET_DIR)/etc
Signature · 1 line
1.8.1.2
#8 lore raw

PATCH 4/5 Makefile: do not try to strip inexisting file when stripping libpthread

Quoted 9 lines · Thomas Petazzoni

libpthread.so has a special stripping condition to preserve parts of it that are needed for debugging. However, due to the usage of 'xargs' instead of 'xargs -r', the strip command is executed regardless of whether a libpthread.so file is found or not. This leads to a big error message being displayed in static-only builds, because strip is executed without a file argument. Thanks to the '|| true', the build continues, but still shows a big error message in the middle, which is not nice.

Quoted 5 lines

By using 'xargs -r', we avoid the strip command from being executed when 'find' doesn't find any match. We also remove the '|| true' to catch other real errors.

I'd find it more natural to use the -exec option of find, but this
patch solves a real problem so

Quoted 18 lines
---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 5d40126..9201f27 100644
@@ -485,7 +485,7 @@ endif
  # I set a breakpoint"
  ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
  	find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
-		xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
+		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
  endif
 
  	mkdir -p $(TARGET_DIR)/etc
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#9 lore raw

PATCH 4/5 Makefile: do not try to strip inexisting file when stripping libpthread

In reply to Thomas Petazzoni
Quoted 9 lines · Thomas Petazzoni

libpthread.so has a special stripping condition to preserve parts of it that are needed for debugging. However, due to the usage of 'xargs' instead of 'xargs -r', the strip command is executed regardless of whether a libpthread.so file is found or not. This leads to a big error message being displayed in static-only builds, because strip is executed without a file argument. Thanks to the '|| true', the build continues, but still shows a big error message in the middle, which is not nice.

Quoted 5 lines

By using 'xargs -r', we avoid the strip command from being executed when 'find' doesn't find any match. We also remove the '|| true' to catch other real errors.

Committed, thanks.

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

PATCH 5/5 kmod: does not support static builds

In reply to Thomas Petazzoni

Since kmod 14, the support for building a static library has been removed completely from kmod. Therefore, we mark kmod as !BR2_PREFER_STATIC_LIB, as well as all its reverse dependencies, which includes the option to use the "udev" /dev management method.

---
 package/kmod/Config.in | 1 +
 package/udev/Config.in | 1 +
 system/Config.in       | 1 +
 3 files changed, 3 insertions(+)
package/kmod/Config.in +1 -0
index 4965237..bd44316 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_KMOD
 	bool "kmod"
+	depends on !BR2_PREFER_STATIC_LIB
 	help
 	  handle kernel modules
 
package/udev/Config.in +1 -0
index dd5ad7b..d4d97c1 100644
@@ -3,6 +3,7 @@ config BR2_PACKAGE_UDEV
 	depends on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
 	depends on BR2_LARGEFILE # util-linux
 	depends on BR2_USE_WCHAR # util-linux
+	depends on !BR2_PREFER_STATIC_LIB # kmod
 	select BR2_PACKAGE_UTIL_LINUX
 	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
 	select BR2_PACKAGE_KMOD
system/Config.in +1 -0
index d41f184..55195e0 100644
@@ -84,6 +84,7 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
 	bool "Dynamic using udev"
 	depends on BR2_LARGEFILE # udev
 	depends on BR2_USE_WCHAR # udev
+	depends on !BR2_PREFER_STATIC_LIB # udev -> kmod
 	select BR2_PACKAGE_UDEV
 
 comment "udev requires a toolchain with LARGEFILE + WCHAR support"
Signature · 1 line
1.8.1.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

PATCH 5/5 kmod: does not support static builds

Dear Arnout Vandecappelle,

(Resending with Buildroot list in Cc)

Quoted 10 lines · Arnout Vandecappelle
Quoted 6 lines · Thomas Petazzoni

Since kmod 14, the support for building a static library has been removed completely from kmod. Therefore, we mark kmod as !BR2_PREFER_STATIC_LIB, as well as all its reverse dependencies, which includes the option to use the "udev" /dev management method.

I don't think that patches that fix PREFER_STATIC builds are important
enough to still include in 2013.08.

I agree.

Quoted 13 lines

package/kmod/Config.in line 5

Quoted 10 lines
package/kmod/Config.in +1 -0
index 4965237..bd44316 100644
@@ -1,5 +1,6 @@
  config BR2_PACKAGE_KMOD
  	bool "kmod"
+	depends on !BR2_PREFER_STATIC_LIB
  	help
  	  handle kernel modules

Shouldn't you also remove the

Quoted 3 lines

KMOD_CONF_OPT = --disable-static --enable-shared

?

No because the default is --enable-static --enable-shared, and the configure script of kmod bails out with an error when --enable-static is passed.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#13 lore raw

PATCH 5/5 kmod: does not support static builds

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Since kmod 14, the support for building a static library has been Thomas> removed completely from kmod. Therefore, we mark kmod as Thomas> !BR2_PREFER_STATIC_LIB, as well as all its reverse dependencies, which Thomas> includes the option to use the "udev" /dev management method.

Thomas> Signed-off-by: Thomas Petazzoni <[email protected]> Thomas> ---

 Thomas>  package/kmod/Config.in | 1 +
 Thomas>  package/udev/Config.in | 1 +
 Thomas>  system/Config.in       | 1 +

Thomas> 3 files changed, 3 insertions(+)

Thomas> diff --git a/package/kmod/Config.in b/package/kmod/Config.in Thomas> index 4965237..bd44316 100644
Thomas> --- a/package/kmod/Config.in
Thomas> +++ b/package/kmod/Config.in
Thomas> @@ -1,5 +1,6 @@
Thomas> config BR2_PACKAGE_KMOD
Thomas> bool "kmod"
Thomas> + depends on !BR2_PREFER_STATIC_LIB
Thomas> help
Thomas> handle kernel modules

Thomas> diff --git a/package/udev/Config.in b/package/udev/Config.in Thomas> index dd5ad7b..d4d97c1 100644
Thomas> --- a/package/udev/Config.in
Thomas> +++ b/package/udev/Config.in
Thomas> @@ -3,6 +3,7 @@ config BR2_PACKAGE_UDEV

 Thomas>  	depends on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
 Thomas>  	depends on BR2_LARGEFILE # util-linux
 Thomas>  	depends on BR2_USE_WCHAR # util-linux
 Thomas> +	depends on !BR2_PREFER_STATIC_LIB # kmod
 Thomas>  	select BR2_PACKAGE_UTIL_LINUX
 Thomas>  	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
 Thomas>  	select BR2_PACKAGE_KMOD
 Thomas> diff --git a/system/Config.in b/system/Config.in
 Thomas> index d41f184..55195e0 100644
 Thomas> --- a/system/Config.in
 Thomas> +++ b/system/Config.in
 Thomas> @@ -84,6 +84,7 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
 Thomas>  	bool "Dynamic using udev"
 Thomas>  	depends on BR2_LARGEFILE # udev
 Thomas>  	depends on BR2_USE_WCHAR # udev

Thomas> + depends on !BR2_PREFER_STATIC_LIB # udev -> kmod
Thomas> select BR2_PACKAGE_UDEV

Thomas> comment "udev requires a toolchain with LARGEFILE + WCHAR support"

The dependency between udev handling and !BR2_PREFER_STATIC_LIB isn't directly obvious to users, so I've added a comment - Similar to how we do it for toolchain options.

Committed with that added, thanks.

Signature · 1 line
Bye, Peter Korsgaard