Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ccache to base-builder. #12675

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions infra/base-images/base-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ RUN export PYTHON_DEPS="\
rm -rf /usr/local/lib/python3.8/test && \
apt-get remove -y $PYTHON_DEPS # https://github.com/google/oss-fuzz/issues/3888


ENV CCACHE_VERSION 4.10.2
RUN cd /tmp && curl -OL https://github.com/ccache/ccache/releases/download/v$CCACHE_VERSION/ccache-$CCACHE_VERSION.tar.xz && \
tar -xvf ccache-$CCACHE_VERSION.tar.xz && cd ccache-$CCACHE_VERSION && \
mkdir build && cd build && \
export LDFLAGS='-lpthread' && \
cmake -D CMAKE_BUILD_TYPE=Release .. && \
make -j && make install && \
rm -rf /tmp/ccache-$CCACHE_VERSION /tmp/ccache-$CCACHE_VERSION.tar.xz

# Install six for Bazel rules.
RUN unset CFLAGS CXXFLAGS && pip3 install -v --no-cache-dir \
six==1.15.0 && rm -rf /tmp/*
Expand Down Expand Up @@ -180,4 +190,13 @@ COPY llvmsymbol.diff $SRC
COPY detect_repo.py /opt/cifuzz/
COPY bazel.bazelrc /root/.bazelrc

# Set up ccache binary and cache directory.
# /ccache/bin will contain the compiler wrappers, and /ccache/cache will
# contain the actual cache, which can be saved.
# To use this, set PATH=/ccache/bin:$PATH.
RUN mkdir -p /ccache/bin && mkdir -p /ccache/cache && \
ln -s /usr/local/bin/ccache /ccache/bin/clang && \
ln -s /usr/local/bin/ccache /ccache/bin/clang++
ENV CCACHE_DIR /ccache/cache

CMD ["compile"]
Loading