Merge pull request #10045 from ethereum/libabicoderFuzzingDocker

Remove antlr and add libabicoder to ossfuzz docker image.
This commit is contained in:
chriseth 2020-10-15 18:51:02 +02:00 committed by GitHub
commit 19606c46b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@
# (c) 2016-2019 solidity contributors.
#------------------------------------------------------------------------------
FROM gcr.io/oss-fuzz-base/base-clang as base
LABEL version="4"
LABEL version="5"
ARG DEBIAN_FRONTEND=noninteractive
@ -32,7 +32,7 @@ RUN apt-get update; \
software-properties-common \
ninja-build git wget \
libbz2-dev zlib1g-dev git curl uuid-dev \
pkg-config openjdk-8-jdk liblzma-dev unzip; \
pkg-config openjdk-8-jdk liblzma-dev unzip mlton; \
apt-get install -qy python-pip python-sphinx;
# Install cmake 3.14 (minimum requirement is cmake 3.10)
@ -43,20 +43,24 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5
FROM base AS libraries
# Boost
RUN git clone -b boost-1.69.0 https://github.com/boostorg/boost.git \
/usr/src/boost; \
cd /usr/src/boost; \
git submodule update --init --recursive; \
./bootstrap.sh --with-toolset=clang --prefix=/usr; \
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" headers; \
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" \
RUN set -ex; \
cd /usr/src; \
wget -q 'https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2' -O boost.tar.bz2; \
test "$(sha256sum boost.tar.bz2)" = "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402 boost.tar.bz2"; \
tar -xf boost.tar.bz2; \
rm boost.tar.bz2; \
cd boost_1_73_0; \
CXXFLAGS="-stdlib=libc++ -pthread" LDFLAGS="-stdlib=libc++" ./bootstrap.sh --with-toolset=clang --prefix=/usr; \
./b2 toolset=clang cxxflags="-stdlib=libc++ -pthread" linkflags="-stdlib=libc++ -pthread" headers; \
./b2 toolset=clang cxxflags="-stdlib=libc++ -pthread" linkflags="-stdlib=libc++ -pthread" \
link=static variant=release runtime-link=static \
system filesystem unit_test_framework program_options \
install -j $(($(nproc)/2)); \
rm -rf /usr/src/boost
rm -rf /usr/src/boost_1_73_0
# Z3
RUN git clone --depth 1 -b z3-4.8.9 https://github.com/Z3Prover/z3.git \
RUN set -ex; \
git clone --depth 1 -b z3-4.8.9 https://github.com/Z3Prover/z3.git \
/usr/src/z3; \
cd /usr/src/z3; \
mkdir build; \
@ -109,23 +113,16 @@ RUN set -ex; \
ninja install/strip; \
rm -rf /usr/src/hera
# ANTLR4 RUNTIME
# libabicoder
RUN set -ex; \
cd /usr/src; \
wget https://www.antlr.org/download/antlr4-cpp-runtime-4.8-source.zip; \
rm -rf antlr4-runtime && mkdir antlr4-runtime; \
unzip antlr4-cpp-runtime-4.8-source.zip -d antlr4-runtime; \
cd antlr4-runtime && mkdir build && cd build; \
cmake .. -DWITH_LIBCXX=On -DCMAKE_BUILD_TYPE=Release -DWITH_DEMO=False; \
make -j; \
DESTDIR=run make install; \
# Manually copy needed library and includes since install script
# does not respect -DCMAKE_INSTALL_DIR and there is no option
# to disable shared library build/installation
cp -Rf run/usr/local/include/antlr4-runtime /usr/include; \
cp -f run/usr/local/lib/libantlr4-runtime.a /usr/lib; \
rm -rf /usr/src/antlr4-cpp-runtime-4.8-source.zip; \
rm -rf /usr/src/antlr4-runtime
git clone https://github.com/ekpyron/Yul-Isabelle; \
cd Yul-Isabelle; \
cd libabicoder; \
CXX=clang++ CXXFLAGS="-stdlib=libc++ -pthread" make; \
cp libabicoder.a /usr/lib; \
cp abicoder.hpp /usr/include; \
rm -rf /usr/src/Yul-Isabelle
FROM base
COPY --from=libraries /usr/lib /usr/lib