Skip to content

Conversation

@vladimiroltean
Copy link
Contributor

Commit 7ab8275 ("tests/patch/build_clang: use LLVM=1 to enable clang") seems to have unnecessarily dropped CC="ccache clang" when transitioning to LLVM=1. This increases build times.

We can still use LLVM=1 to get the LLVM linker etc, but still override CC with "ccache clang" to cache the object files instead of compiling them.

Commit 7ab8275 ("tests/patch/build_clang: use LLVM=1 to enable
clang") seems to have unnecessarily dropped CC="ccache clang" when
transitioning to LLVM=1. This increases build times.

We can still use LLVM=1 to get the LLVM linker etc, but still override
CC with "ccache clang" to cache the object files instead of compiling
them.

Signed-off-by: Vladimir Oltean <[email protected]>
@kuba-moo
Copy link
Contributor

I dropped the hack because I thought it wasn't necessary. At least on Fedora I have:

 ~]$ readlink -f `which gcc`
/usr/bin/ccache
 ~]$ readlink -f `which clang`
/usr/bin/ccache

IOW to some extent not using ccache for clang is a system configuration issue.

@vladimiroltean
Copy link
Contributor Author

Is that something that you have to configure your system to do, or is it something that Fedora does?
On a Debian Trixie container, no such thing happens.

nipa@9b2e11e8481b:/app$ readlink -f `which gcc`
/usr/bin/x86_64-linux-gnu-gcc-14
nipa@9b2e11e8481b:/app$ readlink -f `which clang`
/usr/lib/llvm-19/bin/clang
nipa@9b2e11e8481b:/app$ readlink -f `which ccache`
/usr/bin/ccache

@kuba-moo
Copy link
Contributor

Fedora does it automatically for me. I think the philosophy is that if you install ccache you probably want it to be used. Whether it historically didn't enable ccache for clang or I just assumed it doesn't because clang is so damn slow is unclear at this stage :)

I'm not an OS expert but there's something called alternatives which may let you link clang to ccache in an OS-sanctioned way?

@matttbe
Copy link
Member

matttbe commented Oct 28, 2025

On Debian and similar, I think I always had to add /usr/lib/ccache to PATH. In a Dockerfile, I usually add:

ENV PATH=/usr/lib/ccache:${PATH}

I just noticed the ccache Debian wiki page also suggests calling /usr/sbin/update-ccache-symlinks in containers.

Maybe it is better to let the user controlling if ccache can be used or not? It is an extra dependence, use more space, and not needed for just one build.

@kuba-moo
Copy link
Contributor

Actually, I didn't realize we do still throw in ccache explicitly for GCC. We should be consistent.

@kuba-moo kuba-moo merged commit 3639fd1 into linux-netdev:main Oct 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants