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. # (c) 2016-2019 solidity contributors.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
FROM gcr.io/oss-fuzz-base/base-clang as base FROM gcr.io/oss-fuzz-base/base-clang as base
LABEL version="4" LABEL version="5"
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
@ -32,7 +32,7 @@ RUN apt-get update; \
software-properties-common \ software-properties-common \
ninja-build git wget \ ninja-build git wget \
libbz2-dev zlib1g-dev git curl uuid-dev \ 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; apt-get install -qy python-pip python-sphinx;
# Install cmake 3.14 (minimum requirement is cmake 3.10) # 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 FROM base AS libraries
# Boost # Boost
RUN git clone -b boost-1.69.0 https://github.com/boostorg/boost.git \ RUN set -ex; \
/usr/src/boost; \ cd /usr/src; \
cd /usr/src/boost; \ wget -q 'https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2' -O boost.tar.bz2; \
git submodule update --init --recursive; \ test "$(sha256sum boost.tar.bz2)" = "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402 boost.tar.bz2"; \
./bootstrap.sh --with-toolset=clang --prefix=/usr; \ tar -xf boost.tar.bz2; \
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" headers; \ rm boost.tar.bz2; \
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" \ 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 \ link=static variant=release runtime-link=static \
system filesystem unit_test_framework program_options \ system filesystem unit_test_framework program_options \
install -j $(($(nproc)/2)); \ install -j $(($(nproc)/2)); \
rm -rf /usr/src/boost rm -rf /usr/src/boost_1_73_0
# Z3 # 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; \ /usr/src/z3; \
cd /usr/src/z3; \ cd /usr/src/z3; \
mkdir build; \ mkdir build; \
@ -109,23 +113,16 @@ RUN set -ex; \
ninja install/strip; \ ninja install/strip; \
rm -rf /usr/src/hera rm -rf /usr/src/hera
# ANTLR4 RUNTIME # libabicoder
RUN set -ex; \ RUN set -ex; \
cd /usr/src; \ cd /usr/src; \
wget https://www.antlr.org/download/antlr4-cpp-runtime-4.8-source.zip; \ git clone https://github.com/ekpyron/Yul-Isabelle; \
rm -rf antlr4-runtime && mkdir antlr4-runtime; \ cd Yul-Isabelle; \
unzip antlr4-cpp-runtime-4.8-source.zip -d antlr4-runtime; \ cd libabicoder; \
cd antlr4-runtime && mkdir build && cd build; \ CXX=clang++ CXXFLAGS="-stdlib=libc++ -pthread" make; \
cmake .. -DWITH_LIBCXX=On -DCMAKE_BUILD_TYPE=Release -DWITH_DEMO=False; \ cp libabicoder.a /usr/lib; \
make -j; \ cp abicoder.hpp /usr/include; \
DESTDIR=run make install; \ rm -rf /usr/src/Yul-Isabelle
# 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
FROM base FROM base
COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/lib /usr/lib