Convert oss-fuzz-build to use cmake

This commit is contained in:
Jay Berkenbilt 2022-03-12 10:05:36 -05:00 committed by Jay Berkenbilt
parent 5ee21c67c9
commit 87db567e1f
3 changed files with 14 additions and 19 deletions

View File

@ -80,11 +80,8 @@ GOOGLE OSS-FUZZ
Clone the oss-fuzz project. From the root directory of the repository:
Add `-e GITHUB_FORK=fork -e GITHUB_BRANCH=branch` to build_fuzzers
from a qpdf fork/branch rather than qpdf/main.
python3 infra/helper.py build_image --pull qpdf
python3 infra/helper.py build_fuzzers [ --sanitizer memory|undefined|address ] qpdf
python3 infra/helper.py build_fuzzers [ --sanitizer memory|undefined|address ] qpdf [path-to-qpdf-source]
python3 infra/helper.py check_build qpdf
python3 infra/helper.py build_fuzzers --sanitizer coverage qpdf
python3 infra/helper.py coverage qpdf

View File

@ -4,8 +4,12 @@ export WORK=$PWD/work
export OUT=$PWD/out
mkdir -p $WORK $OUT
sudo apt-get update
sudo apt-get -y install \
autoconf build-essential zlib1g-dev libjpeg-dev
sudo apt-get -y install build-essential cmake zlib1g-dev libjpeg-dev
./fuzz/oss-fuzz-build
ls -l out/qpdf*fuzzer
ls -l out/qpdf_fuzzer
ls -l out/
if ldd out/qpdf_fuzzer | egrep 'libjpeg|libz|libqpdf'; then
echo 1>&2 "*** Fuzzers linked dynamically with some dependent libraries."
ldd out/qpdf_fuzzer
exit 2
fi

View File

@ -21,15 +21,9 @@ if [[ $GITHUB_FORK != "" ]]; then
fi
fi
./configure \
--enable-oss-fuzz \
--enable-static \
--disable-shared \
--enable-crypto-native \
--disable-implicit-crypto \
--prefix="$WORK" \
LDFLAGS="-L$WORK/lib" \
CPPFLAGS="-I$WORK/include" \
LIBS="-pthread"
make -j$(nproc) install
make install_fuzz
env CMAKE_PREFIX_PATH=$WORK LDFLAGS="-L$WORK/lib -lpthread" \
cmake -S . -B build \
-DOSS_FUZZ=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_BUILD_TYPE=Debug \
-DUSE_IMPLICIT_CRYPTO=0 -DREQUIRE_CRYPTO_NATIVE=1
cmake --build build -j$(nproc) --target fuzzers
cmake --install build --component fuzz