Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify determining what caused the caching to fail #1096

Open
Trass3r opened this issue Jun 10, 2022 · 6 comments
Open

Simplify determining what caused the caching to fail #1096

Trass3r opened this issue Jun 10, 2022 · 6 comments
Labels
improvement Improvement that is not a bug fix or new feature

Comments

@Trass3r
Copy link

Trass3r commented Jun 10, 2022

It would be nice if it was easier to determine what kind of compiler options stopped ccache from working.
Currently you have to set CCACHE_DEBUG and capture the files and grep through them manually for the Compiler option -Yc .....hxx is unsupported.

Maybe it could be reported while compiling (in verbose mode) or somehow capture it in the statistics output.

Uncacheable:
  Unsupported compiler option:    9
@Trass3r Trass3r added the improvement Improvement that is not a bug fix or new feature label Jun 10, 2022
@jrosdahl jrosdahl changed the title simplify determining what caused the caching to fail Simplify determining what caused the caching to fail Jun 11, 2022
@jrosdahl
Copy link
Member

It would be nice if it was easier to determine what kind of compiler options stopped ccache from working. Currently you have to set CCACHE_DEBUG and capture the files and grep through them manually for the Compiler option -Yc .....hxx is unsupported.

There is an easier way: Set CCACHE_LOGFILE and grep that file instead of all files created by CCACHE_DEBUG.

It would perhaps be possible to introduce another kind of log file where only "problems" (whatever that is) are logged, but I'm not sure it that would be worth the effort when the information is already present in the standard log.

Maybe it could be reported while compiling (in verbose mode)

That's unfortunately not possible since ccache is not allowed to print to stdout or stderr. The reason for this is that it then wouldn't behave as the real compiler.

or somehow capture it in the statistics output.

Uncacheable:
  Unsupported compiler option:    9

Do you mean to include something like Compiler option -Yc .....hxx is unsupported in the statistics output? That won't be possible in a reasonable way, I'm afraid.

@firewave
Copy link

That's unfortunately not possible since ccache is not allowed to print to stdout or stderr. The reason for this is that it then wouldn't behave as the real compiler.

That's probably awkward but what about setting something like an environment variable like CCACHE_STRICT which will cause ccache to exit with an error when e.g. an unsupported option is encountered. That should would not break the drop-in requirement and also "solve" the issue.

@jrosdahl
Copy link
Member

what about setting something like an environment variable like CCACHE_STRICT which will cause ccache to exit with an error when e.g. an unsupported option is encountered

That could work.

@ruimaciel

This comment was marked as off-topic.

@jrosdahl

This comment was marked as off-topic.

@afbjorklund
Copy link
Contributor

afbjorklund commented Jan 4, 2024

It would perhaps be possible to introduce another kind of log file where only "problems" (whatever that is) are logged, but I'm not sure it that would be worth the effort when the information is already present in the standard log.

We introduced the stats_log for scenarios where the log_file (with all the debugging information) would be too much to handle, there could be another log to record the filenames only (presumably compare this with changed files)

I think I had something where the compile command was kept in the log, that is now available in CCACHE_DEBUG. Could add the file name as "comments" to the command line (to extract or search for), like we did in the stats_log?

# foo.c
cc -c foo.c

stats_log

# foo.c
direct_cache_hit
local_storage_hit
local_storage_read_hit
local_storage_read_hit

...
[2024-01-04T08:43:22.918599 85629] Command line: ./ccache cc -c foo.c
[2024-01-04T08:43:22.918609 85629] Hostname: ubuntu
[2024-01-04T08:43:22.918614 85629] Working directory: /home/anders/ccache/build
[2024-01-04T08:43:22.918828 85629] Compiler: /usr/bin/cc
[2024-01-04T08:43:22.918839 85629] Compiler type: gcc
[2024-01-04T08:43:22.918879 85629] Detected input file: foo.c
[2024-01-04T08:43:22.918941 85629] Source file: foo.c
[2024-01-04T08:43:22.918950 85629] Object file: foo.o
...

3.7-maint...afbjorklund:ccache:command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement that is not a bug fix or new feature
Projects
None yet
Development

No branches or pull requests

5 participants