Bug 11676 - ccache should do no caching when it encounters -S
ccache should do no caching when it encounters -S
Status: RESOLVED WORKSFORME
Product: ccache
Classification: Unclassified
Component: ccache
unspecified
All All
: P5 normal
: ---
Assigned To: Joel Rosdahl
Joel Rosdahl
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-15 12:29 UTC by Adrien Nader
Modified: 2016-06-09 19:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrien Nader 2016-01-15 12:29:58 UTC
GCC's build system has some configure tests which use -S and then look at the unassembled output. When the test is done a second time, ccache will not have any .S file to write to the filesystem and GCC's configure will fail because it can't find the file it expected.

As far as I understand, this could be solved by adding { -S, TOO_HARD } to compopt.c's compopts[].
Comment 1 Joel Rosdahl 2016-01-16 16:02:09 UTC
Hi,

ccache has had support for the -S flag since literally day one, so it's supposed to work.

I can't reproduce the problem. First I cleared the cache:

    % ccache -Cz
    Cleared cache
    Statistics cleared

First compilation via ccache:

    % rm -f test.*; touch test.c; ccache /usr/bin/gcc -c -S test.c

First compilation via ccache produced a test.s file:

    % ls -l test.*
    -rw-rw-r-- 1 joel joel   0 Jan 16 16:50 test.c
    -rw-rw-r-- 1 joel joel 103 Jan 16 16:50 test.s

Ccache reports a cache miss:

    % ccache -s
    cache directory                     /home/joel/.ccache
    primary config                      /home/joel/.ccache/ccache.conf
    secondary config      (readonly)    /usr/local/etc/ccache.conf
    cache hit (direct)                     0
    cache hit (preprocessed)               0
    cache miss                             1
    files in cache                         2
    cache size                           8.2 kB
    max cache size                       5.0 GB

Second compilation via ccache:

    % rm test.s; ccache /usr/bin/gcc -c -S test.c

The result is as expected:

    % ls -l test.*
    -rw-rw-r-- 1 joel joel   0 Jan 16 16:51 test.c
    -rw-rw-r-- 1 joel joel 103 Jan 16 16:51 test.s

Ccache reports a cache hit:

    % ccache -s
    cache directory                     /home/joel/.ccache
    primary config                      /home/joel/.ccache/ccache.conf
    secondary config      (readonly)    /usr/local/etc/ccache.conf
    cache hit (direct)                     1
    cache hit (preprocessed)               0
    cache miss                             1
    files in cache                         2
    cache size                           8.2 kB
    max cache size                       5.0 GB

I have also tried running without "-c" (in which case ccache just runs the compiler directly) and with "-o". Both cases work fine.

Could you tell me more about what command line GCC's build system uses? Try running with CCACHE_LOGFILE to get some clues.
Comment 2 Joel Rosdahl 2016-06-09 19:45:51 UTC
Closing this now since I can't reproduce the problem. Please create a new issue at https://github.com/ccache/ccache/issues if wanted.