From 4ad673ecfc2fdb6b010dee440115c2f2b808c5f9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 30 Sep 2011 13:58:29 -0400 Subject: [PATCH] check_deps: dynamically insert native multilib path Rather than hardcoding every possible multilib path that we might come across, look up the native multilib path that the target system is using by finding the native ELF interpreter. We use /bin/sh as a known good file since you can't really have a system without this. BUG=chromium-os:20636 TEST=`./check_deps /build/amd64-generic /bin/bash` now finds libs without explicit ld.so.conf TEST=`./build_image --board=x86-alex` still works Change-Id: Ib80824312a5e5a0f9e17e8ae18a2d42248771eb7 Reviewed-on: http://gerrit.chromium.org/gerrit/8564 Commit-Ready: Mike Frysinger Reviewed-by: Mike Frysinger Tested-by: Mike Frysinger --- build_library/check_deps | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build_library/check_deps b/build_library/check_deps index 82519c6eef..54e25b2483 100755 --- a/build_library/check_deps +++ b/build_library/check_deps @@ -65,15 +65,33 @@ class CheckDependencies(object): self._libcache = set() self._verbose = verbose + libdirs = [] + + # Add the native paths. Get the ELF interpreter from a known file + # and assume that the path it is in is our native libdir. So here + # we would get something like "/lib64/ld-linux-x86-64.so.2". + elf = "/bin/sh" + f = os.popen("scanelf -qF'%%i#p' %s/%s" % (root, elf)) + native_libdir = os.path.dirname(f.readline().rstrip()) + f.close() + if len(native_libdir) == 0: + print >>sys.stderr, "Problem with %s: can't find ELF interp" % elf + sys.exit(1) + elif native_libdir != "/lib": + libdirs.extend([ + "%s/%s" % (root, native_libdir), + "%s/usr%s" % (root, native_libdir) + ]) + # Insert some default directories into our library cache. - libdirs = [ + libdirs.extend([ "%s/lib" % root, "%s/usr/lib" % root, "%s/opt/google/o3d/lib" % root, "%s/usr/lib/opengl/xorg-x11/lib" % root, "%s/usr/local/lib/icedtea6/jre/lib/i386/client" % root, "%s/usr/local/lib/icedtea6/jre/lib/i386/headless" % root - ] + ]) # Read more directories from ld.so.conf. libdirs.extend(self._ReadLdSoConf("/etc/ld.so.conf"))