ccache no longer works for NCS in Windows with newer versions of ccache

There was no problem when the current version of ccache was 4.6.1. However, the current version of ccache, 4.10.2, behaves differently with the --specs option. It will do nothing at all with NCS. To correct this, I make this change

diff --git a/cmake/modules/ccache.cmake b/cmake/modules/ccache.cmake
index c1d41d6b9e4..14b9b683519 100644
--- a/cmake/modules/ccache.cmake
+++ b/cmake/modules/ccache.cmake
@@ -9,7 +9,7 @@ if(USE_CCACHE STREQUAL "0")
else()
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
- set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache ignore_options=--specs=picolibc.specs")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()
endif()

Thank you for any possible correction. I guess in the Linux case you include ccache in the Zephyr toolchain and it is a version that works.

Burt Silverman

Parents
  • Hi Burt,

    Thank you for reporting your observation. I apologize, as I am not very familiar with ccache, but I am trying to better understand your issue.

    I see that NCS 2.8.0 uses ccache version 4.8.2 by default. Are you using an environment set up with the latest ccache version 4.10.2?

    If that’s the case, I encourage you to use the default toolchain whenever possible. We will ensure that the build process is compatible with the newer toolchain and ccache 4.10.2 in future updates.

    Best regards,

    Charlie

  • Hi Charlie,

    I believe you are referring to the Linux version of NCS 2.8.0, which includes the ccache version you mention. Maybe Mac, too; I forget.

    The Windows version of the toolchains do not include ccache. I don't recall where in the documentation for installing NCS on Windows do they explicitly mention ccache, but in general I believe Chocolatey is recommended for bringing in some tools, and I believe Chocolatey would bring in the 4.10.2.

    Can you verify that ccache is pulled in when following the documentation instructions to install NCS on Windows? Does it happen automatically when using VS Code and otherwise does not get pulled in? I just always remember to make certain I have it, whether or not I found it in the instructions.

    In Windows, if you execute the 2 command sequence:

    set VERBOSE=1
    west build ...

    you can look at some of the C file compilations to see if ccache is being invoked. 

    If ccache is invoked, you can see if it is caching by running a pristine build, then issuing "ccache -z" to zero out statistics, then run the pristine build again, then run "ccache -s -v" and you should see hundreds of cache hits in the statistics printed out; otherwise, you know it is not working. You shouldn't see any instances of "not cached due to bad parameter" or something to that effect

    Thanks, Charlie.

    Burt

Reply
  • Hi Charlie,

    I believe you are referring to the Linux version of NCS 2.8.0, which includes the ccache version you mention. Maybe Mac, too; I forget.

    The Windows version of the toolchains do not include ccache. I don't recall where in the documentation for installing NCS on Windows do they explicitly mention ccache, but in general I believe Chocolatey is recommended for bringing in some tools, and I believe Chocolatey would bring in the 4.10.2.

    Can you verify that ccache is pulled in when following the documentation instructions to install NCS on Windows? Does it happen automatically when using VS Code and otherwise does not get pulled in? I just always remember to make certain I have it, whether or not I found it in the instructions.

    In Windows, if you execute the 2 command sequence:

    set VERBOSE=1
    west build ...

    you can look at some of the C file compilations to see if ccache is being invoked. 

    If ccache is invoked, you can see if it is caching by running a pristine build, then issuing "ccache -z" to zero out statistics, then run the pristine build again, then run "ccache -s -v" and you should see hundreds of cache hits in the statistics printed out; otherwise, you know it is not working. You shouldn't see any instances of "not cached due to bad parameter" or something to that effect

    Thanks, Charlie.

    Burt

Children
No Data
Related