[Buildroot] [PATCH 2/2] Choose host/target ldconfig based on availability

Malte Starostik m-starostik at versanet.de
Sun Jul 18 20:16:47 UTC 2010


Decide whether to use the host or target ldconfig based on an
availability check instead of internal/external toolchain selection.  An
external toolchain may very well provide an ldconfig while the host's
one may fail.
External toolchain generated by Gentoo crossdev:

$ LC_ALL=C i686-pc-linux-uclibc-ldconfig -r output/target/; echo $?
i686-pc-linux-uclibc-ldconfig: skipping /usr/lib: No such file or directory
0

vs. the host (x86_64-pc-linux-gnu) version:

$ LC_ALL=C /sbin/ldconfig -r output/target/; echo $?
/sbin/ldconfig: Can't open configuration file
output/target/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
1
---
 package/Makefile.in |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/Makefile.in b/package/Makefile.in
index 189806d..1962466 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -127,10 +127,10 @@ TARGET_RANLIB   = $(TARGET_CROSS)ranlib
 TARGET_OBJCOPY  = $(TARGET_CROSS)objcopy
 TARGET_OBJDUMP  = $(TARGET_CROSS)objdump
 
-ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
-TARGET_LDCONFIG = $(TARGET_CROSS)ldconfig
-else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
+ifeq ($(shell $(SHELL) -c "command -v $(TARGET_CROSS)ldconfig"),)
 TARGET_LDCONFIG = /sbin/ldconfig
+else
+TARGET_LDCONFIG = $(TARGET_CROSS)ldconfig
 endif
 
 ifeq ($(BR2_STRIP_strip),y)
-- 
1.7.1




More information about the buildroot mailing list