glibc: Fix for 'ldconfg -v' complaining about 'path given more than once' and 'No such file or directory'

Message ID 20200514125452.13030-1-matthias.fischer@ipfire.org
State Dropped
Headers
Series glibc: Fix for 'ldconfg -v' complaining about 'path given more than once' and 'No such file or directory' |

Commit Message

Matthias Fischer May 14, 2020, 12:54 p.m. UTC
  1. After upgrading to 64bit and doing an simple update, 'ldconfig -v' told me:

   ...
   ldconfig: Path `/lib64' given more than once
   ldconfig: Can't stat /libx32: No such file or directory
   ldconfig: Path `/usr/lib64' given more than once
   ldconfig: Can't stat /usr/libx32: No such file or directory
   ...

   Searching for this messages led me to https://trac.clfs.org/ticket/1098
   ("Remove extra /lib64, /libx32 references from ldconfig for Pure64")

   => I built a patch and tested. Running here. Works.

2. While checking '_build.base.log' I found that the first patch seemed to
   need some adjustments:

   ...
   cd /usr/src/glibc-2.31 && patch -Np1 < /usr/src/src/patches/glibc-localedef-no-archive.patch
   patching file localedata/Makefile
   Hunk #1 succeeded at 434 with fuzz 1 (offset 211 lines).
   ...

   => I moved this patch to the new 'glibc' patch directory and adjusted the line
   number.

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
 lfs/glibc                                     |  3 ++-
 .../glibc-localedef-no-archive.patch          |  9 ++++---
 ..._references_from_ldconfig_for_pure64.patch | 27 +++++++++++++++++++
 3 files changed, 34 insertions(+), 5 deletions(-)
 rename src/patches/{ => glibc}/glibc-localedef-no-archive.patch (54%)
 create mode 100644 src/patches/glibc/remove_extra_lib64_libx32_references_from_ldconfig_for_pure64.patch
  

Patch

diff --git a/lfs/glibc b/lfs/glibc
index f9959c6e3..182b75eb5 100644
--- a/lfs/glibc
+++ b/lfs/glibc
@@ -125,12 +125,13 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
 	@mkdir $(DIR_SRC)/glibc-build
 
-	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-localedef-no-archive.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-localedef-no-archive.patch
 
 ifneq "$(TOOLCHAIN)" "1"
  ifeq "$(BUILD_ARCH)" "x86_64"
 	cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \
 		scripts/test-installation.pl
+	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/glibc/remove_extra_lib64_libx32_references_from_ldconfig_for_pure64.patch
  endif
 
  ifeq "$(BUILD_ARCH)" "i586"
diff --git a/src/patches/glibc-localedef-no-archive.patch b/src/patches/glibc/glibc-localedef-no-archive.patch
similarity index 54%
rename from src/patches/glibc-localedef-no-archive.patch
rename to src/patches/glibc/glibc-localedef-no-archive.patch
index 40bc68dc3..f4d040ff7 100644
--- a/src/patches/glibc-localedef-no-archive.patch
+++ b/src/patches/glibc/glibc-localedef-no-archive.patch
@@ -1,10 +1,11 @@ 
---- glibc-2.27/localedata/Makefile~	2018-02-07 22:31:00.968944449 +0000
-+++ glibc-2.27/localedata/Makefile	2018-02-07 22:31:26.201764894 +0000
-@@ -223,6 +223,7 @@ $(INSTALL-SUPPORTED-LOCALES): install-lo
+diff -U 3 a/localedata/Makefile b/localedata/Makefile
+--- a/localedata/Makefile	Sat Feb  1 12:52:50 2020
++++ b/localedata/Makefile	Thu May 14 10:53:33 2020
+@@ -434,6 +434,7 @@
  	echo -n '...'; \
  	input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
  	$(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
 +		     --no-archive \
  		     -i locales/$$input -f charmaps/$$charset \
  		     $(addprefix --prefix=,$(install_root)) $$locale \
- 	&& echo ' done'; \
+ 	&& echo ' done';
diff --git a/src/patches/glibc/remove_extra_lib64_libx32_references_from_ldconfig_for_pure64.patch b/src/patches/glibc/remove_extra_lib64_libx32_references_from_ldconfig_for_pure64.patch
new file mode 100644
index 000000000..900e702fb
--- /dev/null
+++ b/src/patches/glibc/remove_extra_lib64_libx32_references_from_ldconfig_for_pure64.patch
@@ -0,0 +1,27 @@ 
+diff -U 3 a/sysdeps/unix/sysv/linux/x86_64/dl-cache.h b/sysdeps/unix/sysv/linux/x86_64/dl-cache.h
+--- a/sysdeps/unix/sysv/linux/x86_64/dl-cache.h	Thu May 14 01:13:16 2020
++++ b/sysdeps/unix/sysv/linux/x86_64/dl-cache.h	Thu May 14 01:19:49 2020
+@@ -27,6 +27,9 @@
+       size_t len = strlen (dir);				\
+       char path[len + 4];					\
+       memcpy (path, dir, len + 1);				\
++add_dir (path); \
++} while (0)
++#define unused_var \
+       if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6))	\
+ 	{							\
+ 	  len -= 2;						\
+diff -U 3 a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
+--- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h	Thu May 14 01:13:16 2020
++++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h	Thu May 14 01:20:00 2020
+@@ -18,9 +18,7 @@
+ #include <sysdeps/generic/ldconfig.h>
+ 
+ #define SYSDEP_KNOWN_INTERPRETER_NAMES \
+-  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
+-  { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
+-  { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
++  { "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
+ #define SYSDEP_KNOWN_LIBRARY_NAMES \
+   { "libc.so.6", FLAG_ELF_LIBC6 },	\
+   { "libm.so.6", FLAG_ELF_LIBC6 },