Skip to content

Commit 673925b

Browse files
committed
Install 32-bit dependencies in the 32-bit build environment.
1 parent 771d9c5 commit 673925b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

scripts/32bitdeps.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script is called in a 32-bit build environment to install necessary
4+
# dependencies.
5+
6+
set -ex
7+
8+
# Work out if we need to install with sudo or not.
9+
if [[ $(id -u) -eq 0 ]]
10+
then
11+
# We are root, so we can install without sudo.
12+
echo "Running as root, no sudo required."
13+
export SUDO=""
14+
else
15+
# We are not root, so we need to use sudo.
16+
echo "Running as non-root, using sudo."
17+
export SUDO="sudo"
18+
fi
19+
20+
# Download dependencies for oss-fuzz
21+
$SUDO dpkg --add-architecture i386
22+
$SUDO apt-get -o Dpkg::Use-Pty=0 update
23+
$SUDO apt-get -o Dpkg::Use-Pty=0 install -y \
24+
protobuf-compiler:i386 \
25+
libprotobuf-dev:i386 \
26+
libstdc++-9-dev:i386

scripts/compile_target.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export BUILD_ROOT; BUILD_ROOT=$(readlink -f "${SCRIPTDIR}/..")
3131
# shellcheck source=stdlib_flag_utils.sh
3232
source "${SCRIPTDIR}/stdlib_flag_utils.sh"
3333

34+
# Install any 32-bit dependencies if building for 32-bit.
35+
if [[ "${ARCHITECTURE:-}" == "i386" ]]
36+
then
37+
"${SCRIPTDIR}/32bitdeps.sh"
38+
fi
39+
3440
# Check for GDB-specific behaviour by checking for the GDBMODE flag.
3541
# - Compile with -O0 so that DEBUGASSERTs can be debugged in gdb.
3642
if [[ -n ${GDBMODE:-} ]]

0 commit comments

Comments
 (0)