Python's on-target "build C extensions" logic duplicates the compiler flags used at build time, which means if ccache is enabled then it ends up in the target: /usr/lib/python-sysconfigdata/_sysconfigdata.py: 'CC': 'ccache ' This means that without ccache being installed into the target, extension compilation will fail. For example, the python3-cffi ptests fail: cffi.VerificationError: CompileError: command 'ccache' failed: No such file or directory