libarchive: fix xenial build to latest base (#6441)

* libarchive: fix xenial build to latest base

* libarchive: switch to cmake build
This commit is contained in:
DavidKorczynski 2021-09-15 01:36:51 +01:00 committed by GitHub
parent 3341d86a1e
commit 1194a4d59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 19 deletions

View File

@ -14,18 +14,14 @@
#
################################################################################
# Using Ubuntu 16.04 because of breakage on Ubuntu 20.04.
# See https://github.com/google/oss-fuzz/issues/6291 for more details.
FROM gcr.io/oss-fuzz-base/base-builder:xenial
# Delete line above and uncomment line below to upgrade to 20.04.
# FROM gcr.io/oss-fuzz-base/base-builder
FROM gcr.io/oss-fuzz-base/base-builder
# Installing optional libraries can utilize more code path and/or improve
# performance (avoid calling external programs).
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config \
libbz2-dev liblzo2-dev liblzma-dev liblz4-dev libz-dev \
libxml2-dev libssl-dev libacl1-dev libattr1-dev lrzip \
libssl-dev libacl1-dev libattr1-dev lrzip \
liblz4-tool lzop zstd lcab genisoimage jlha-utils rar default-jdk
RUN git clone --depth 1 https://github.com/libarchive/libarchive.git
WORKDIR libarchive
RUN git clone --depth 1 https://gitlab.gnome.org/GNOME/libxml2.git
COPY build.sh libarchive_fuzzer.cc $SRC/
WORKDIR $SRC

View File

@ -15,18 +15,35 @@
#
################################################################################
# build the project
./build/autogen.sh
./configure
make -j$(nproc) all
# compile libxml2 from source so we can statically link
DEPS=/deps
mkdir ${DEPS}
cd $SRC/libxml2
./autogen.sh \
--without-debug \
--without-ftp \
--without-http \
--without-legacy \
--without-python
make -j$(nproc)
make install
cp .libs/libxml2.a ${DEPS}/
cd $SRC/libarchive
sed -i 's/-Wall//g' ./CMakeLists.txt
sed -i 's/-Werror//g' ./CMakeLists.txt
mkdir build2
cd build2
cmake ../
make
# build seed
cp $SRC/libarchive/contrib/oss-fuzz/corpus.zip\
$OUT/libarchive_fuzzer_seed_corpus.zip
# build fuzzer(s)
$CXX $CXXFLAGS -Ilibarchive \
$CXX $CXXFLAGS -I../libarchive \
$SRC/libarchive_fuzzer.cc -o $OUT/libarchive_fuzzer \
$LIB_FUZZING_ENGINE .libs/libarchive.a \
-Wl,-Bstatic -lbz2 -llzo2 -lxml2 -llzma -lz -lcrypto -llz4 -licuuc \
-licudata -Wl,-Bdynamic
$LIB_FUZZING_ENGINE ./libarchive/libarchive.a \
-lcrypto -lacl -llzma -llz4 -lbz2 -lz ${DEPS}/libxml2.a