Search code examples
ccachearm-none-eabi-gcc

Using ccache with '-specs=nano.specs'


I'm trying to cross-compile with arm-none-eabi-gcc, which needs the flag -specs=nano.specs.

Unfortunately that seems to break ccache. In the logs I now have:

[2024-01-24T10:36:58.306578 191738] Failed to lstat nano.specs: No such file or directory
[2024-01-24T10:36:58.306581 191738] While processing -specs=nano.specs: nano.specs is missing
[2024-01-24T10:36:58.306602 191738] Failed; falling back to running the real compiler

I tried to add a --ccache-skip in front of specs=nano.specs but that doesn't seem to have any effect.

How can I tell ccache to ignore the nano.specs file?


Solution

  • The --ccache-skip flag should probably work as expected, but in the meantime there are work-arounds:

    1. Use ignore_options/CCACHE_IGNOREOPTIONS
    2. Specify the full path to the nano.specs. For example, -specs=/usr/lib/arm-none-eabi/lib/nano.specs.

    I ended up using the ignore_options.

    From my Makefile (slightly simplified):

    CC = ccache ignore_options=-specs=nano.specs arm-none-eabi-gcc