Document why `re2` must build Abseil for fuzzing. (#11334)

While I'm here, tidy and tweak a couple of things.
This commit is contained in:
Paul Wankadia 2023-12-07 17:18:55 +00:00 committed by GitHub
parent 651204890e
commit 6d97b8562e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -15,14 +15,11 @@
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update -y && apt-get install -y make autoconf automake libtool \
cmake pkg-config
RUN apt-get update -y && apt-get install -y cmake make pkg-config
# At the time of writing, OSS-Fuzz uses Ubuntu focal (20.04 LTS), but
# libabsl-dev isn't available until Ubuntu jammy (22.04 LTS), so build
# and install Abseil from source.
# https://github.com/abseil/abseil-cpp/issues/1524#issuecomment-1739364093
# explains why Abseil must be built for fuzzing, not depended on normally.
RUN git clone --depth=1 https://github.com/abseil/abseil-cpp
RUN git clone --depth 1 https://github.com/google/re2
COPY build.sh $SRC/

View File

@ -15,11 +15,15 @@
#
################################################################################
CXXFLAGS="$CXXFLAGS -O2"
# First, build and install Abseil.
# N.B., this is pasted verbatim from what libphonenumber does here.
# https://github.com/abseil/abseil-cpp/issues/1524#issuecomment-1739364093
# explains why Abseil must be built for fuzzing, not depended on normally.
# N.B., this is pasted almost verbatim from what libphonenumber does here.
cd $SRC/abseil-cpp
mkdir build && cd build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ../ && make && make install
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. && make -j$(nproc) && make install
ldconfig
# Second, build and install RE2.
@ -34,9 +38,7 @@ ldconfig
# interrogate pkg-config about the Abseil dependencies instead of
# maintaining yet another enumeration of them here.
cd $SRC/re2
CXXFLAGS="$CXXFLAGS -O2"
make -j$(nproc) obj/libre2.a
make common-install
make -j$(nproc) obj/libre2.a && make common-install
# Third, build the fuzzer (distributed with RE2).
$CXX $CXXFLAGS -I. \