[Buildroot] make sdk - relocate - ccache not working as expected

Matthew Weber matthew.weber at rockwellcollins.com
Mon Jun 1 11:32:06 UTC 2020


On Sat, May 30, 2020 at 11:15 AM Jaap Crezee <jaap at jcz.nl> wrote:
> Hello all,
> I am using a Buildroot generated (make sdk; 2020.02) toolchain which I use on different
> computers and I run into a problem where ccache keeps using the orignal temporary location
> for the ccache cache, despite having ran sdk-relocate.sh:
> Relocating the buildroot SDK from
> /data/work/jcz/git/jidiot/clients/demo_rpi/buildroot_initramfs/output/host to
> /var/lib/jenkins/workspace/argets_Demo_rpi_feature_rpi_zero/toolchain/ext ...
> ...
> ccache: error: Failed to create directory
> /data/work/jcz/git/jidiot/clients/demo_rpi/.cache/cc/tmp: Permission denied
> Is this a known problem? If not, how to proceed?

The ccache callback's path is compiled into the toolchain-wrapper, so
you'd have to disable ccache and do a clean build before doing the
make sdk.  Or set the BR_NO_CCACHE=1 environment variable when using
your sdk.  Something I've done in my sdk exports is adjust the
toolchain wrapper before running make sdk. Here's an untested example
of something you could add to your post build script or adjust the
tarball to have this change after make sdk runs.

       if [ ! -f "${BASE_DIR}/host/bin/buildroot-toolchain-wrapper" ]; then
        cp "${BASE_DIR}/host/bin/toolchain-wrapper"
        cat <<-EOF >"${BASE_DIR}/host/bin/toolchain-wrapper"
                # Disable Buildroot's ccache callback
                dir="\$(dirname "\$0")"
                BR_NO_CCACHE=1 exec -a "\$0"
"\$dir/buildroot-toolchain-wrapper" "\$@"
        chmod +x "${BASE_DIR}/host/bin/toolchain-wrapper"

Best Regards,

More information about the buildroot mailing list