[CMake] Re: CMake and distcc

Rodolfo Lima rodolfo at rodsoft.org
Thu Jan 17 08:00:13 EST 2008


Eric Noulard escreveu:
> I think that when you build a gcc cross compiler you end up
> with the "i486-linux-gnu-gcc" kind of naming scheme I don't
> know if it's standard or not but...

Well, I every linux distribution I know the gcc install target ends up
creating symlinks like i686-pc-linux-gnu-gcc -> gcc, so we may say it's
a standard, IMHO. BUT if you create a cross compiler, it'll only create
x86_64-pc-linux-gnu-gcc (for instance), this way the local
architecture's gcc won't be overwriten. This way you can choose if you
want to call a cross-compiler or the local compiler, based on it's
'complete name' (well, I invented this term for this discussion).


> When you setup your distcc farm you should either install
> your cross-compiler with a consistent naming scheme for gcc
> or symlink the native compiler with the appropriate pseudo
> cross-compiler name.
As I said, this is done automatically by the gcc installer.

> After that invoking CMake on the master box with
> the following command line:
> 
> CC="distcc i686-pc-linux-gnu-gcc" cmake .
> and then
> make -jX

By using the scheme I've mentioned in my previous post, I could invoke:
CC="i686-pc-linux-gnu-gcc" cmake, and this is the method called
'masquerading' in distcc man page.

> 
> So when you previously said:
>> The problem is that normally cmake chooses /usr/bin/gcc as the compiler.
> 
> this is not quite true (I think) if you tell CMake using CC envar like:
> CC="i686-pc-linux-gnu-gcc" cmake .

But the point is to make it transparent to the user. In my machine I've
got everything set up for distributed compilation. I don't want (or
need) to care anymore about it. The procedure to compile a local project
should be the same whether I use distcc or not (that's why the scheme is
called masquerade installation). For this to work, cmake should pick
i686-pc-linux-gnu-gcc as the compiler. Since it's always symlinked to
gcc in the local machine, this would always work, whether you're using
distcc or not. Once again, autoconf does exactly that.

But at least for me this is a non-issue now. In /usr/lib/distcc/bin (the
masquerade directory), I've created the script:

#!/bin/sh
distcc i686-pc-linux-gnu-gcc $@

called gcc. This works well and should be IMHO proposed to distcc
developers because it deals with cmake's way to invoking gcc. But even
with it, it would be 'nice' if cmake used i686-pc-linux-gnu, just to
follow the steps of autoconf. There's no harm in doing that.

Regards,
rod



More information about the CMake mailing list