From b4dd89a93fcbbc113011d8f83e6f92ad875c65f5 Mon Sep 17 00:00:00 2001
From: Sam Thursfield <sam.thursfield@codethink.co.uk>
Date: Mon, 18 Sep 2017 19:04:57 +0100
Subject: gnu-toolchain: Set correct sysconfdir for stage2-glibc

We install the ld.so config to /etc/ld.so.conf in the stage2-glibc element,
but the ldconfig tool would look for /tools/etc/ld.so.conf. This caused no
problems for a long time, I suppose because we always built on top of
sysroots that had an existing /etc/ld.so.cache file. But if `ldconfig`
hadn't already been run in the sysroot, builds depending on stage2-glibc
would fail as various things would no longer be able to find libz.so due
the ldconfig command failing to find its config file.
---
 elements/gnu-toolchain/stage2-glibc.bst | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

(limited to 'elements/gnu-toolchain/stage2-glibc.bst')

diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst
index 1871a4e5..46396ec6 100644
--- a/elements/gnu-toolchain/stage2-glibc.bst
+++ b/elements/gnu-toolchain/stage2-glibc.bst
@@ -26,9 +26,11 @@ config:
 
   # Configure flag notes:
   #   1. Avoid installing to PREFIX/lib64 on x86_64.
-  #   2. Location of linux-api-headers.
-  #   3. Normal flags. See glibc.morph.
-  #   4. Force configuration values of certain things that can't be detected
+  #   2. We install ld.so.conf to /etc, not /tools/etc, and we need to ensure
+  #      ldconfig looks for it in the right place.
+  #   3. Location of linux-api-headers.
+  #   4. Normal flags. See glibc.morph.
+  #   5. Force configuration values of certain things that can't be detected
   #      in a cross-compile.
   - |
     case "%{bst-target-arch}" in
@@ -42,9 +44,10 @@ config:
       --build=$(../scripts/config.guess) --host=%{target-stage1} \
       --prefix="%{prefix}" \
       `# [1]` --libdir="%{prefix}/lib" \
-      `# [2]` --with-headers="%{prefix}/include" \
-      `# [3]` --disable-profile  --enable-kernel=2.6.25 \
-      `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
+      `# [2]` --sysconfdir="/etc" \
+      `# [3]` --with-headers="%{prefix}/include" \
+      `# [4]` --disable-profile  --enable-kernel=2.6.25 \
+      `# [5]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
               libc_cv_forced_unwind=yes libc_cv_ssp=no
 
   build-commands:
-- 
cgit v1.2.1

