Skip to contentSkip to conversation

fix ldconfig at target-finalize

PATCH New Baruch Siach 2 participants 4 messages Jun 16, 2010 – Jun 28, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix ldconfig at target-finalize

Host ldconfig fails when the directory of the aux-cache file (/var/cache/ldconfig, by default) does not exist. Make sure this directory exists before calling ldconfig.

---
 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Makefile +1 -0
index 794a298..1415e30 100644
@@ -402,6 +402,7 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)
 	rm -rf $(TARGET_DIR)/usr/share/gtk-doc
 endif
 	find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true
+	mkdir -p $(TARGET_DIR)/var/cache/ldconfig
 	$(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null
 
 	mkdir -p $(TARGET_DIR)/etc
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 fix ldconfig at target-finalize

Quoted 4 lines · Baruch Siach

Host ldconfig fails when the directory of the aux-cache file (/var/cache/ldconfig, by default) does not exist. Make sure this directory exists before calling ldconfig.

Also would be good to do a "touch $(TARGET_DIR)/etc/ld.so.conf" too, along with your mkdir.

Then you get rid of both errors...

/sbin/ldconfig: Can't open configuration file (...)/target-dir/etc/ld.so.conf: No such file or directory /sbin/ldconfig: Can't open cache file /var/cache/ldconfig/aux-cache : No such file or directory

Do you need me to provide a patch file to do this?

Cheers
Andy

Quoted 21 lines

Signed-off-by: Baruch Siach
<[email protected]>
---
Makefile | 1 +

1 files changed, 1 insertions(+), 0 deletions(-)
Makefile +0 -0
index 794a298..1415e30 100644
@@ -402,6 +402,7 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)
 rm -rf $(TARGET_DIR)/usr/share/gtk-doc

endif
find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null ||
true
+ mkdir -p $(TARGET_DIR)/var/cache/ldconfig $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null

mkdir -p $(TARGET_DIR)/etc

Signature · 1 line
1.7.1 
#2 lore raw

PATCH 1/1 fix ldconfig at target-finalize

Hi Andy,

Quoted 9 lines · Andy Gibbs
Quoted 4 lines · Baruch Siach

Host ldconfig fails when the directory of the aux-cache file (/var/cache/ldconfig, by default) does not exist. Make sure this directory exists before calling ldconfig.

Also would be good to do a "touch $(TARGET_DIR)/etc/ld.so.conf" too, along with your mkdir.

Quoted 8 lines

Then you get rid of both errors...

/sbin/ldconfig: Can't open configuration file (...)/target-dir/etc/ld.so.conf: No such file or directory /sbin/ldconfig: Can't open cache file /var/cache/ldconfig/aux-cache : No such file or directory

Do you need me to provide a patch file to do this?

This patch fixes both problems for me. Do you still encounter failure after applying this patch?

baruch

Quoted 19 lines
Quoted 19 lines

Signed-off-by: Baruch Siach
<[email protected]>
---
Makefile | 1 +

1 files changed, 1 insertions(+), 0 deletions(-)
Makefile +0 -0
index 794a298..1415e30 100644
@@ -402,6 +402,7 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)

rm -rf $(TARGET_DIR)/usr/share/gtk-doc
endif
find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true
+ mkdir -p $(TARGET_DIR)/var/cache/ldconfig $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null

mkdir -p $(TARGET_DIR)/etc

Signature · 3 lines
                                                     ~. .~   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/1 fix ldconfig at target-finalize

Quoted 20 lines · Baruch Siach

Hi Andy,

Quoted 17 lines · Andy Gibbs
Quoted 5 lines · Baruch Siach

Host ldconfig fails when the directory of the aux-cache file (/var/cache/ldconfig, by default) does not exist. Make sure this directory
exists before calling ldconfig.

Also would be good to do a "touch $(TARGET_DIR)/etc/ld.so.conf" too, along with your mkdir.

Then you get rid of both errors...

/sbin/ldconfig: Can't open configuration file (...)/target-dir/etc/ld.so.conf: No such file or directory /sbin/ldconfig: Can't open cache file /var/cache/ldconfig/aux-cache : No such file or directory

Quoted 6 lines
Quoted 1 line

Do you need me to provide a patch file to do this?

This patch fixes both problems for me. Do you still encounter failure after
applying this patch?

I'm afraid I did. I am running buildroot with a toolchain created by crosstool-ng for powerpc. Since crosstool doesn't generate a cross-ldconfig, buildroot is picking up the one on my PC at /sbin. I believe in contrast uclibc *does* generate a cross-ldconfig. Up until the end of last week I never got an error, but then I upgraded eglibc on my PC from 2.9 to 2.11.1 and then this error happened. Searching the web found your post, and helped me find the solution to my own problem - so I am very grateful!

However, I am wondering whether it is better simply to remove the ldconfig step in my case, since it doesn't actually do anything useful, and I need to run it on the target anyway to correctly initialise the ld cache.

So, I then thought about patching Makefile to make the line in question become:

ifneq ($(BR2_TOOLCHAIN_EXTERNAL),y)
$(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null
endif

Or alternatively, disabling it via a change to 'package/Makefile.in' changing the block around line 140:

ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TARGET_LDCONFIG=$(TARGET_CROSS)ldconfig
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
TARGET_LDCONFIG=/sbin/ldconfig
endif

to:

ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TARGET_LDCONFIG=$(TARGET_CROSS)ldconfig
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
TARGET_LDCONFIG=/bin/true
endif

But this may not really be appropriate for an upstream patch, since I do not know the rationale that set the TARGET_LDCONFIG variable to be /sbin/ldconfig when an external toolchain is used. Maybe a better approach would be an additional setting inside buildroot that enables the ldconfig line to be disabled. Also then it could disable its use in other places where its used during the build.

Unfortunately, however, I don't think such a patch is within my grasp to write! But I will happily test it if someone else feels that they want to do it.

Cheers
Andy