From ec2d611c267b47b412eea0fd21dbc54d23dff095 Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Mon, 7 Dec 2020 21:35:08 +0000 Subject: [PATCH] hermetic build: hermetic host tools Use the glibc prebuilt sysroot as sysroot for all host tools. In order to use that, also add the prebuilt kernel tools (include, lib64) to satisfy dependencies like openssl (via boringssl). Bug: 135570712 Signed-off-by: Matthias Maennich Change-Id: I20bc005488b166b8363c17af9a602c66f7db6298 --- _setup_env.sh | 12 ++++++++++++ build-tools/sysroot | 1 + hermetic/Dockerfile | 2 -- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 120000 build-tools/sysroot diff --git a/_setup_env.sh b/_setup_env.sh index 2a61312..b1a0f66 100644 --- a/_setup_env.sh +++ b/_setup_env.sh @@ -108,6 +108,18 @@ if [ -n "${HERMETIC_TOOLCHAIN}" ]; then # (e.g. debug info) export KCPPFLAGS="-ffile-prefix-map=${ROOT_DIR}/=" + # set the common sysroot + sysroot_flags+="--sysroot=${ROOT_DIR}/build/build-tools/sysroot " + + # add openssl (via boringssl) and other prebuilts into the lookup path + cflags+="-I${ROOT_DIR}/prebuilts/kernel-build-tools/linux-x86/include " + + # add openssl and further prebuilt libraries into the lookup path + ldflags+="-Wl,-rpath,${ROOT_DIR}/prebuilts/kernel-build-tools/linux-x86/lib64 " + ldflags+="-L ${ROOT_DIR}/prebuilts/kernel-build-tools/linux-x86/lib64 " + + export HOSTCFLAGS="$sysroot_flags $cflags" + export HOSTLDFLAGS="$sysroot_flags $ldflags" fi for PREBUILT_BIN in "${PREBUILTS_PATHS[@]}"; do diff --git a/build-tools/sysroot b/build-tools/sysroot new file mode 120000 index 0000000..d0298f1 --- /dev/null +++ b/build-tools/sysroot @@ -0,0 +1 @@ +../../prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot \ No newline at end of file diff --git a/hermetic/Dockerfile b/hermetic/Dockerfile index 502e6b6..70aa2f2 100644 --- a/hermetic/Dockerfile +++ b/hermetic/Dockerfile @@ -5,8 +5,6 @@ RUN apt-get -y update \ # Those are likely essential git \ # To be removed - libc6-dev \ - libssl-dev \ rsync \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*