Bug 10795 - Read-only mode; running real compiler
Summary: Read-only mode; running real compiler
Status: RESOLVED INVALID
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.1.6
Hardware: x64 Linux
: P5 normal
Target Milestone: ---
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-05 09:25 UTC by MK
Modified: 2014-11-08 15:46 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 MK 2014-09-05 09:25:08 UTC
Hello,

ENV Variable:

CCACHE_PREFIX=distcc
CCACHE_READONLY=1
CCACHE_LOGFILE=/tmp/ccache.harish.log
CCACHE_BASE=/home/builder3/cache/ccache
CCACHE_TEMPDIR=/home/hchandrasekaran/.ccache

get Read Only Mode all the time. How to fix this? Also it is complaing that the .o is not in cache but the .o files are in cache.

[2014-09-05T14:24:46.165564 40971] Got object file hash from preprocessor
[2014-09-05T14:24:46.165578 40971] Preprocessor created ../../../pf_ne/ppc/cmn/dep/component-SysCommon-TpPayload-S.i
[2014-09-05T14:24:46.165610 40971] Object file /home/builder3/cache/ccache/sb-nile-icomm-431/ppc/d/6/108dccb7a911267203f815e0c289fd-269481.o not in cache
[2014-09-05T14:24:46.165618 40971] Read-only mode; running real compiler
[2014-09-05T14:24:46.165626 40971] Failed; falling back to running the real compiler
Comment 1 Joel Rosdahl 2014-09-07 19:01:42 UTC
Hi,

> CCACHE_READONLY=1
> [...]
> get Read Only Mode all the time. How to fix this?

I don't think I understand the issue. If you have set CCACHE_READONLY=1, then ccache will work in read-only mode. Isn't this what you intended?

> Also it is complaing that the .o is not in cache but the .o files are in cache.

Do you mean that /home/builder3/cache/ccache/sb-nile-icomm-431/ppc/d/6/108dccb7a911267203f815e0c289fd-269481.o exists but ccache says it doesn't exist?
Comment 2 MK 2014-09-10 03:06:52 UTC
Yes intended to have read only cache but it is not working as expected.
home/builder3/cache/ccache/sb-nile-icomm-431/ppc/d/6/
108dccb7a911267203f815e0c289fd-269481.o
exists but ccache says it doesn't exist.

On Sun, Sep 7, 2014 at 12:01 PM, <samba-bugs@samba.org> wrote:

> https://bugzilla.samba.org/show_bug.cgi?id=10795
>
> --- Comment #1 from Joel Rosdahl <joel@rosdahl.net> 2014-09-07 19:01:42
> UTC ---
> Hi,
>
> > CCACHE_READONLY=1
> > [...]
> > get Read Only Mode all the time. How to fix this?
>
> I don't think I understand the issue. If you have set CCACHE_READONLY=1,
> then
> ccache will work in read-only mode. Isn't this what you intended?
>
> > Also it is complaing that the .o is not in cache but the .o files are in
> cache.
>
> Do you mean that
>
> /home/builder3/cache/ccache/sb-nile-icomm-431/ppc/d/6/108dccb7a911267203f815e0c289fd-269481.o
> exists but ccache says it doesn't exist?
>
> --
> Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 3 Joel Rosdahl 2014-09-10 17:40:39 UTC
I suggest running via strace to find out more details about what happens. I.e., something like this:

  strace ccache compiler args ... 2>&1 | grep 108dccb7a911267203f815e0c289fd
Comment 4 MK 2014-10-01 10:11:08 UTC
Hello,

I think I found the issue that when compiling in different directories,
cache is not found since the compiler option has -g (includes absolute
path).

i.e. cache is updated when compiled under folder /home/builder/main/src and
CCACHE_DIR is CCACHE_DIR=/home/builder/cache/ccache/main and if we
recompile the code under same folder again, cache gets hit and compilation
is fast.

However if the compilation is done under different
folder /home/harish/main/src, it is computing different hash and hence
falls back on real compilation.

I understand that setting CCACHE_BASEDIR mitigates this problem, But what
we need to set for CCACHE_BASEDIR when compiling with ccache  for these two
folders /home/harish/main/src and /home/builder/main/src , so that hash is
computed same for both?

Thanks for the help

Regards,
Murali
​
Comment 5 Joel Rosdahl 2014-11-08 15:46:31 UTC
> I think I found the issue that when compiling in different directories,
> cache is not found since the compiler option has -g (includes absolute
> path).

OK, but this is a totally different issue than the one you reported, right?

> However if the compilation is done under different
> folder /home/harish/main/src, it is computing different hash and hence
> falls back on real compilation.

Yup, that's expected and has nothing to do with read-only mode.

> I understand that setting CCACHE_BASEDIR mitigates this problem, But what
> we need to set for CCACHE_BASEDIR when compiling with ccache  for these two
> folders /home/harish/main/src and /home/builder/main/src , so that hash is
> computed same for both?

See the manual section "Compiling in different directories": <http://ccache.samba.org/manual.html#_compiling_in_different_directories>. In your case, use "/home".