Kernel compiles but won't boot because of ccache

Ran into a major problem with compiling fedora kernel.

I never ran into issues compiling fedora kernels. Until I switched to clang compilation and installed ccache.

Before, I would compile with gcc, and without ccache, and I’d get a bootable kernel like clockwork.

Now, I couldn’t get a kernel to boot after compiling, even if I used a config from a kernel that actually booted.

My kernel compile times have shrunk to, like, 10-15 mins. But something is screwing up on the ccache side.

It may be ccache+clang issue, but I never ran gcc with ccache, so I can’t untangle whether it’s ccache or ccache+clang. Things are pointing towards ccache being the problem, and there are reports of ccache issues when compiling linux kernels. But I just never expected to not get a bootable kernel all of a sudden. Interestingly, the kernel does compile without error, it just wouldn’t boot.

The kernel would compile longer, almost as long as if ccache was empty, if I changed some major kernel config, and then I would get a bootable kernel. So it really does seem like linking from ccache being the problem.

And when I say kernel wouldn't boot, I mean it hard resetted right after it would load the kernel into memory.

Does anyone else use ccache compiling the Fedora kernel?

When debugging a problem only change one thing at a time.
You have changed two things, compiler to clang and added ccache.

Suggest you remove ccache.
Then clean your build tree of all built artifacts and see if clang works.

Yes, clang works great without ccache. Do not use ccache.

1 Like