From 4f48eab6027a3ab3e4b87893f7ec275f67f62922 Mon Sep 17 00:00:00 2001 From: Matt Delco Date: Wed, 19 Feb 2020 12:24:43 -0800 Subject: build_test.py: set env vars for cross compile Now that minijail-sys is added a simple run of ./build_test fails with messages like: error: failed to run custom build command for `minijail-sys v0.0.11 (/mnt/host/source/src/aosp/external/minijail)` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CrossCompilation', src/libcore/result.rs:1165:5 This change adds various environment variables to address the problem. BUG=None TEST=./build_test.py --arm-sysroot /build/cheza/ --aarch64-sysroot /build/kevin64/ Change-Id: Iba15ceafa35ba3ab2d08dc5827af3cb8ee07530c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2064821 Reviewed-by: Daniel Verkamp Tested-by: Daniel Verkamp Tested-by: kokoro Commit-Queue: Matt Delco --- build_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'build_test.py') diff --git a/build_test.py b/build_test.py index 81d09db..f0a78c4 100755 --- a/build_test.py +++ b/build_test.py @@ -160,10 +160,20 @@ def check_build(sysroot, triple, kind, test_it, clean): is_release = kind == 'release' + # The pkgconfig dir could be in either lib or lib64 depending on the target. + # Rather than checking to see which one is valid, just add both and let + # pkg-config search. + libdir = os.path.join(sysroot, 'usr', 'lib', 'pkgconfig') + lib64dir = os.path.join(sysroot, 'usr', 'lib64', 'pkgconfig') + env = os.environ.copy() env['TARGET_CC'] = '%s-clang'%triple env['SYSROOT'] = sysroot env['CARGO_TARGET_DIR'] = target_path + env['PKG_CONFIG_ALLOW_CROSS'] = '1' + env['PKG_CONFIG_LIBDIR'] = libdir + ':' + lib64dir + env['PKG_CONFIG_SYSROOT_DIR'] = sysroot + env['RUSTFLAGS'] = '-C linker=' + env['TARGET_CC'] if test_it: if not test_target(triple, is_release, env): -- cgit 1.4.1