[distcc] Re: Introduction: distcc for msvc

Martin Pool mbp at canonical.com
Mon Jul 31 02:40:02 GMT 2006


On 27 Jul 2006, Tom Aratyn <themystic.ca at gmail.com> wrote:
> Hi Martin,
> 
> As Shaver said, we're working on getting distcc working with MS cl. In order
> to do that we must make some changes to your code. Up to now we've been
> reading your code and we would like to run some of our thoughts by you to
> get your opinion on how to best make changes so that our patch can make it
> into the trunk.
> 
> We think there are two basic routes we can go: one is having two different
> binary versions of distcc using #ifdef's from the same source; another is to
> check the compiler at run time. We think that the latter is a much better
> option. Ideally we'd like to make these changes in such a way as to retain
> the cleanliness and readability of the code (which is *really *clean and
> readable right now.... thanks!)

Yes, ifdefs would be a bit undesirable.  If nothing else it'd be good to
generalize this from not just gcc vs msvc to support more compilers if
people wish to addthem in the future.

> Our idea is to use a global flag to mark which compiler is being used
> (gcc/cc/cl). Then any function which performs a compiler specific operation
> (e.g dcc_strip_local_args() ) would check that flag and call the appropriate
> compiler specific function (i.e. the code currently in
> dcc_strip_local_args() would be moved to dcc_cc_strip_local_args() and
> dcc_strip_local_args() would now check the global flag and call either
> dcc_cc_strip_local_args() or dcc_cl_strip_local_args() ).

Right, or perhaps make it a bit more OO and go through a function
pointer table for each compiler, along the lines of 

  struct dcc_compiler_setup {
    int *strip_local_args(...)
  };

We also need to think about how this will be configured.  Will it be by
looking at argv[1], if not in masquerade mode?  That might be simplest
to start with.

> Another issue is finding volunteers with cl. In order to keep the distcc
> command compatible with both (g)cc and cl we would like to keep their
> "volunteer lists" in two separate environment variables. For backward
> compatibility reasons we feel that the (g)cc volunteers should still be
> listed in $DISTCC_HOSTS and the cl volunteers should be listed somewhere
> like $DISTCC_CL_HOSTS. Also, for backward compatibility reasons, we feel
> that under no circumstance should distcc default to cl. Masquerade mode
> should still default to cc.

Yes, you obviously do need to make sure the volunteer selected has the
right compiler.  Using a separate variable may be a reasonable place to
start.  You should also consider how it would be stored in a host list
on disk.

-- 
Martin


More information about the distcc mailing list