minaco2 / distcc

Automatically exported from code.google.com/p/distcc
GNU General Public License v2.0
0 stars 0 forks source link

Can distcc handle script dependency during compilation? #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have some question to developers of distcc.
When distcc runs compilation commands from make utility, sometimes
there are scripts in them.
Such as 

========= make 3.81 case

if gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\"
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I. -I. -I.  -I./glob 
  -g -O2 -MT ar.o -MD -MP -MF ".deps/ar.Tpo" -c -o ar.o ar.c; \ 
then mv -f ".deps/ar.Tpo" ".deps/ar.Po"; else rm -f ".deps/ar.Tpo"; exit 1; fi

==========================================================================

Of course, above script does not harm to compilation dependencies but 
some script can make problem at compilation dependencies.

It can change the source file that will be used for next compilation jobs.
I know that make utility does not investigate dependencies in scripts of
compilation commands. If some scripts can give effects to compilation
dependencies then distcc(also make utility) cannot guarantee the
correctness of compilation jobs. 

Please let me know how a team of distcc handle above problem.

Thanks.

Original issue reported on code.google.com by reald...@gmail.com on 1 Oct 2008 at 6:55

GoogleCodeExporter commented 9 years ago
Distcc can handle that fine.

There's two ways to handle it using distcc.
The recommended approach is to use

   make CC="distcc gcc"

and for your Makefile to refer to $(CC) rather than gcc.
However, if you have existing scripts or Makefiles that have "gcc" hard-coded, 
and
you don't want to change them, there's a solution for that too.
You can use "masquerading".  See the "MASQUERADING" section of the distcc man 
page.
http://distcc.googlecode.com/svn/trunk/doc/web/man/distcc_1.html#TOC_11

Original comment by fergus.h...@gmail.com on 1 Oct 2008 at 3:43

GoogleCodeExporter commented 9 years ago
Thanks, but I know the usage CC=distcc~.
The question that I did is 

'may scripts can make dependencies with other compilation commands'

Here is some pseudo code:

1 : if distcc a.c then change variable BVAR of b.c to -1 else BVAR=1
2 : distcc c.c
3 : distcc b.c

If distcc launches those three commands in simultaneously, then 3rd compilaiton
job cannot guarantee its correctness.
How distcc handle the dependency problem?

Original comment by reald...@gmail.com on 3 Oct 2008 at 7:25

GoogleCodeExporter commented 9 years ago
Dependency checking is handled by "make".
If you declare the dependencies in your makefile so that
  make -j
works correctly, then
  make -j CC=distcc
should work fine too.
Use of distcc makes no difference to how you should declare the dependencies in 
you makefile.

Original comment by fergus.h...@gmail.com on 3 Oct 2008 at 1:23

GoogleCodeExporter commented 9 years ago
Dependency checking is handled by "make".
If you declare the dependencies in your makefile so that
  make -j
works correctly, then
  make -j CC=distcc
should work fine too.
Use of distcc makes no difference to how you should declare the dependencies in 
you makefile.

Original comment by fergus.h...@gmail.com on 3 Oct 2008 at 2:16

GoogleCodeExporter commented 9 years ago
Dependency checking is handled by "make".
If you declare the dependencies in your makefile so that
  make -j
works correctly, then
  make -j CC=distcc
should work fine too.
Use of distcc makes no difference to how you should declare the dependencies in 
you makefile.

Original comment by fergus.h...@gmail.com on 3 Oct 2008 at 2:16