Skip to content

Commit

Permalink
Make ccache work with jcc.
Browse files Browse the repository at this point in the history
Create ccache wrappers for clang[++]-jcc, and remove the explicit path
from the CC/CXX variables in target_experiment.py.

Note: this is not fully tested end to end yet.

Part of google/oss-fuzz-gen#682.
  • Loading branch information
oliverchang committed Nov 5, 2024
1 parent d5619e1 commit 52383da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 8 additions & 1 deletion infra/base-images/base-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,14 @@ COPY bazel.bazelrc /root/.bazelrc
# 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++
ln -s /usr/local/bin/ccache /ccache/bin/clang++ && \
ln -s /usr/local/bin/ccache /ccache/bin/clang-jcc && \
ln -s /usr/local/bin/ccache /ccache/bin/clang++-jcc
ENV CCACHE_DIR /ccache/cache

# Don't check that the compiler is the same, so we can switch between jcc and
# clang under the hood and re-use the same build cache.
ENV CCACHE_COMPILERCHECK none
ENV CCACHE_COMPILERTYPE clang

CMD ["compile"]
6 changes: 2 additions & 4 deletions infra/build/functions/target_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import build_lib
import build_project

JCC_DIR = '/usr/local/bin'


def run_experiment(project_name, target_name, args, output_path, errlog_path,
build_output_path, upload_corpus_path, upload_coverage_path,
Expand Down Expand Up @@ -62,8 +60,8 @@ def run_experiment(project_name, target_name, args, output_path, errlog_path,
project_yaml['run_tests'] = False

jcc_env = [
f'CC={JCC_DIR}/clang-jcc',
f'CXX={JCC_DIR}/clang++-jcc',
f'CC=clang-jcc',
f'CXX=clang++-jcc',
]
steps = build_project.get_build_steps(project_name,
project_yaml,
Expand Down

0 comments on commit 52383da

Please sign in to comment.