[distcc] Re: Distcc & GDB (fix)

Martin Pool mbp at sourcefrog.net
Mon May 12 01:38:59 GMT 2003

On 11 May 2003, Alexandre Oliva <oliva at lsd.ic.unicamp.br> wrote:

> But then...  I'm thinking we might be able to avoid the
> ccache-interference that the pwd added to the preprocessed file would
> add, and instead add a flag to GCC that would tell it to assume that
> the pwd is actually this. 

Actually what?

> Then, we add a flag to distcc that instructs it to add this
> additional flag to the GCC command line, and everything ``just
> works''

Oh, do you mean that distcc will add a flag to the server-side
invocation of the compiler to tell it the real pwd?  So the user
would need to do 


  gcc -c tmp400.i -o tmp400.o -fsource-dir /home/mbp/work/foo

I suppose that would be OK.  It's not great, because it can't "just
work" automatically -- users have to know whether their version of gcc
supports this, and then set the flag.  But I suppose it's not so bad.

> (well, except that object files would have incorrect pwd information
> if ccache happens to reuse them from a compilation in a different
> directory, but is this so much of a problem?)

This is really a question for tridge, but personally I would rather
have ccache miss, rather than hit on object files that are almost but
not quite accurate.  I realize there are some cases like that already,
but I don't think we want to encourage it.  If there is some parameter
that makes the object file be different then that ought to be part of
the hash.

> See the discussion about macros in
> http://gcc.gnu.org/ml/gcc-patches/2002-08/msg01411.html (this URL
> contains the patch I re-posted yesterday as well).

I agree with you
<http://gcc.gnu.org/ml/gcc-patches/2002-08/msg01449.html> that this is
a bug, and that's why gcc should fix it, regardless of whether the gcc
team cares about distcc/ccache.  A more sensible meaning for that
debug field is the "base directory of compilation", which is what your
<directory> patch does.

It looks to me like Zack and Neil might take that patch, but in a
future version.  Am I misreading them?  Can we try to persuade them?

> I've got two incomplete patches that attempt to address this
> difference, from about the same timeframe, but Niel was even more
> unwilling to admit that this is a bug than in the case of getting
> a different pwds into the compiler's output (which Zack agreed was a
> bug, as you can see in the following thread in the GCC mainling list:
> <URL:http://gcc.gnu.org/ml/gcc-patches/2002-08/threads.html#00960>)

One thing that I have discovered is that taking .i files from one
version of gcc and using them on another is not generally very
successful, because they might include gcc-version-specific header
files, or the application might change its behaviour depending on the
version of gcc.  (The kernel does this, and other programs.)  

Of course it's good to add this information in a clean way, but I'm
not sure that preserving complete compatibility at the .i level
between different versions of gcc is really necessary.


More information about the distcc mailing list