diff --git a/projects/re2/Dockerfile b/projects/re2/Dockerfile index b0aee104b..0e29abdb0 100644 --- a/projects/re2/Dockerfile +++ b/projects/re2/Dockerfile @@ -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/ diff --git a/projects/re2/build.sh b/projects/re2/build.sh index 33c84b400..d362b2043 100755 --- a/projects/re2/build.sh +++ b/projects/re2/build.sh @@ -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. \