2019-08-19 07:35:19 +00:00
|
|
|
# vim:syntax=dockerfile
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Dockerfile for building and testing Solidity Compiler on CI
|
2020-02-20 14:32:28 +00:00
|
|
|
# Target: Ubuntu 16.04 (Xenial Xerus) ossfuzz Clang variant
|
2019-08-19 07:35:19 +00:00
|
|
|
# URL: https://hub.docker.com/r/ethereum/solidity-buildpack-deps
|
|
|
|
#
|
|
|
|
# This file is part of solidity.
|
|
|
|
#
|
|
|
|
# solidity is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# solidity is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with solidity. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
#
|
2021-09-15 10:57:46 +00:00
|
|
|
# (c) 2016-2021 solidity contributors.
|
2019-08-19 07:35:19 +00:00
|
|
|
#------------------------------------------------------------------------------
|
2021-09-16 08:14:13 +00:00
|
|
|
FROM gcr.io/oss-fuzz-base/base-clang:latest as base
|
2023-03-28 09:02:18 +00:00
|
|
|
LABEL version="23"
|
2019-08-19 07:35:19 +00:00
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2020-02-20 14:32:28 +00:00
|
|
|
RUN apt-get update; \
|
|
|
|
apt-get -qqy install --no-install-recommends \
|
2019-08-19 07:35:19 +00:00
|
|
|
build-essential \
|
|
|
|
software-properties-common \
|
2020-02-20 14:32:28 +00:00
|
|
|
ninja-build git wget \
|
2020-08-26 09:37:40 +00:00
|
|
|
libbz2-dev zlib1g-dev git curl uuid-dev \
|
2022-03-01 18:47:39 +00:00
|
|
|
pkg-config openjdk-8-jdk liblzma-dev unzip mlton m4 jq; \
|
2021-09-15 10:57:55 +00:00
|
|
|
apt-get install -qy python3-pip;
|
2019-08-19 07:35:19 +00:00
|
|
|
|
2021-09-13 07:41:45 +00:00
|
|
|
# Install cmake 3.21.2 (minimum requirement is cmake 3.10)
|
|
|
|
RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-Linux-x86_64.sh; \
|
|
|
|
test "$(sha256sum cmake-3.21.2-Linux-x86_64.sh)" = "3310362c6fe4d4b2dc00823835f3d4a7171bbd73deb7d059738494761f1c908c cmake-3.21.2-Linux-x86_64.sh"; \
|
|
|
|
chmod +x cmake-3.21.2-Linux-x86_64.sh; \
|
|
|
|
./cmake-3.21.2-Linux-x86_64.sh --skip-license --prefix="/usr"
|
2019-08-19 07:35:19 +00:00
|
|
|
|
2020-02-20 14:32:28 +00:00
|
|
|
FROM base AS libraries
|
2019-08-19 07:35:19 +00:00
|
|
|
|
|
|
|
# Boost
|
2020-10-15 11:26:40 +00:00
|
|
|
RUN set -ex; \
|
|
|
|
cd /usr/src; \
|
2023-01-11 12:51:32 +00:00
|
|
|
wget -q 'https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2' -O boost.tar.bz2; \
|
|
|
|
test "$(sha256sum boost.tar.bz2)" = "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1 boost.tar.bz2" && \
|
2020-10-15 11:26:40 +00:00
|
|
|
tar -xf boost.tar.bz2; \
|
|
|
|
rm boost.tar.bz2; \
|
2023-01-11 12:51:32 +00:00
|
|
|
cd boost_1_74_0; \
|
2020-10-15 12:40:20 +00:00
|
|
|
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" \
|
2020-02-20 14:32:28 +00:00
|
|
|
link=static variant=release runtime-link=static \
|
2019-10-16 00:31:41 +00:00
|
|
|
system filesystem unit_test_framework program_options \
|
2019-08-19 07:35:19 +00:00
|
|
|
install -j $(($(nproc)/2)); \
|
2023-01-11 12:51:32 +00:00
|
|
|
rm -rf /usr/src/boost_1_74_0
|
2019-08-19 07:35:19 +00:00
|
|
|
|
|
|
|
# Z3
|
2020-10-15 11:26:40 +00:00
|
|
|
RUN set -ex; \
|
2023-03-28 09:02:18 +00:00
|
|
|
git clone --depth 1 -b z3-4.12.1 https://github.com/Z3Prover/z3.git \
|
2019-08-19 07:35:19 +00:00
|
|
|
/usr/src/z3; \
|
|
|
|
cd /usr/src/z3; \
|
2020-02-20 14:32:28 +00:00
|
|
|
mkdir build; \
|
2019-08-19 07:35:19 +00:00
|
|
|
cd build; \
|
2020-02-20 14:32:28 +00:00
|
|
|
LDFLAGS=$CXXFLAGS cmake -DZ3_BUILD_LIBZ3_SHARED=OFF -DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release ..; \
|
|
|
|
make libz3 -j; \
|
2019-08-19 07:35:19 +00:00
|
|
|
make install; \
|
2020-02-20 14:32:28 +00:00
|
|
|
rm -rf /usr/src/z3
|
2019-08-19 07:35:19 +00:00
|
|
|
|
|
|
|
# OSSFUZZ: libprotobuf-mutator
|
|
|
|
RUN set -ex; \
|
|
|
|
git clone https://github.com/google/libprotobuf-mutator.git \
|
|
|
|
/usr/src/libprotobuf-mutator; \
|
|
|
|
cd /usr/src/libprotobuf-mutator; \
|
2020-02-20 09:55:20 +00:00
|
|
|
git checkout 3521f47a2828da9ace403e4ecc4aece1a84feb36; \
|
2019-08-19 07:35:19 +00:00
|
|
|
mkdir build; \
|
|
|
|
cd build; \
|
|
|
|
cmake .. -GNinja -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON \
|
|
|
|
-DLIB_PROTO_MUTATOR_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="/usr"; \
|
|
|
|
ninja; \
|
|
|
|
cp -vpr external.protobuf/bin/* /usr/bin/; \
|
|
|
|
cp -vpr external.protobuf/include/* /usr/include/; \
|
|
|
|
cp -vpr external.protobuf/lib/* /usr/lib/; \
|
|
|
|
ninja install/strip; \
|
|
|
|
rm -rf /usr/src/libprotobuf-mutator
|
|
|
|
|
|
|
|
# EVMONE
|
|
|
|
RUN set -ex; \
|
|
|
|
cd /usr/src; \
|
2022-09-16 11:41:53 +00:00
|
|
|
git clone --branch="v0.9.1" --recurse-submodules https://github.com/ethereum/evmone.git; \
|
2019-08-19 07:35:19 +00:00
|
|
|
cd evmone; \
|
|
|
|
mkdir build; \
|
|
|
|
cd build; \
|
2019-11-12 14:50:39 +00:00
|
|
|
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="/usr" ..; \
|
|
|
|
ninja; \
|
|
|
|
ninja install/strip; \
|
2019-08-19 07:35:19 +00:00
|
|
|
rm -rf /usr/src/evmone
|
|
|
|
|
2020-12-14 13:56:42 +00:00
|
|
|
# gmp
|
|
|
|
RUN set -ex; \
|
|
|
|
# Replace system installed libgmp static library
|
|
|
|
# with sanitized version. Do not perform apt
|
|
|
|
# remove because it removes mlton as well that
|
|
|
|
# we need for building libabicoder
|
|
|
|
rm -f /usr/lib/x86_64-linux-gnu/libgmp.*; \
|
|
|
|
rm -f /usr/include/x86_64-linux-gnu/gmp.h; \
|
|
|
|
cd /usr/src; \
|
|
|
|
wget -q 'https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz' -O gmp.tar.xz; \
|
|
|
|
test "$(sha256sum gmp.tar.xz)" = "fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2 gmp.tar.xz"; \
|
|
|
|
tar -xf gmp.tar.xz; \
|
|
|
|
cd gmp-6.2.1; \
|
|
|
|
./configure --prefix=/usr --enable-static=yes; \
|
|
|
|
make -j; \
|
|
|
|
make install; \
|
|
|
|
rm -rf /usr/src/gmp-6.2.1; \
|
|
|
|
rm -f /usr/src/gmp.tar.xz
|
|
|
|
|
2020-10-15 11:15:41 +00:00
|
|
|
# libabicoder
|
2020-08-26 09:37:40 +00:00
|
|
|
RUN set -ex; \
|
|
|
|
cd /usr/src; \
|
2020-10-15 11:15:41 +00:00
|
|
|
git clone https://github.com/ekpyron/Yul-Isabelle; \
|
|
|
|
cd Yul-Isabelle; \
|
|
|
|
cd libabicoder; \
|
2020-10-15 12:40:20 +00:00
|
|
|
CXX=clang++ CXXFLAGS="-stdlib=libc++ -pthread" make; \
|
2020-10-15 11:15:41 +00:00
|
|
|
cp libabicoder.a /usr/lib; \
|
|
|
|
cp abicoder.hpp /usr/include; \
|
|
|
|
rm -rf /usr/src/Yul-Isabelle
|
2020-08-26 09:37:40 +00:00
|
|
|
|
2019-08-19 07:35:19 +00:00
|
|
|
FROM base
|
|
|
|
COPY --from=libraries /usr/lib /usr/lib
|
|
|
|
COPY --from=libraries /usr/bin /usr/bin
|
2021-07-27 13:20:49 +00:00
|
|
|
COPY --from=libraries /usr/include /usr/include
|