Bug 87859 - Suggestion for distcc improvement in a multi-architecture network
Bug#: 87859 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: All Status: RESOLVED Severity: enhancement Priority: P2
Resolution: FIXED Assigned To: morfic@gentoo.org Reported By: adq_dvb@lidskialf.net
Component: Development
URL: 
Summary: Suggestion for distcc improvement in a multi-architecture network
Keywords:  
Status Whiteboard: 
Opened: 2005-04-03 18:39 0000
Description:   Opened: 2005-04-03 18:39 0000
This is just a suggestion for a change I've found to be useful. Feel free to
ignore if it its not any good :) I just thought it might be handy.

The problem is machine A is i686-pc-linux-gnu. machine B is
powerpc-pc-linux-gnu (well actually its not in my network, but this is a better
example for various reasons).

Now I can install a cross compiler on B so that A can distribute jobs to it no
problem, as long as machine A uses the full compiler name -
i686-pc-linux-gnu-XXX.

However, there is an issue with the current symlinks in /usr/lib/distcc/bin on
machine A. 

Since cc,c++,gcc,g++ are just linked directly to distcc, machine B will be
asked to invoke just 'gcc', where really it should be asked to invoke
i686-pc-linux-gnu-gcc. The result is the compilation fails because it will be
asked to use an (i386 based) architecture it knows nothing about.

This is fixable with a simple change to distcc-config - instead of symlinks for
cc,c++,gcc,g++, create shell scripts like the following on machine A (this
would be called g++):
#!/bin/sh
exec x86_64-pc-linux-gnu-g++ "$@"

This way, it will always use the full compiler name with distcc, which will
then be passed to machine B, which will then invoke the correct cross compiler.

Theres a sample version of distcc-config patched to do this at
http://lidskialf.net/distcc-config.

------- Comment #1 From Andrew de Quincey 2005-04-03 18:42:00 0000 -------
sorry, the sample script I included should be:
#!/bin/sh
exec i686-pc-linux-gnu-g++ "$@"

Too many machines here :)

------- Comment #2 From Lisa Seelye (RETIRED) 2005-04-19 06:03:41 0000 -------
Can you post a diff of your distcc-config and the one in Portage please?

------- Comment #3 From Andrew de Quincey 2005-04-19 06:12:35 0000 -------
Created an attachment (id=56655) [details]
Example modification to use shell scripts

Here you go. It now also creates a 'cc' shell script, which calls ${ARCH}-gcc
since none of the cross compilers I created installed a ${ARCH}-cc link.

------- Comment #4 From Lisa Seelye (RETIRED) 2005-05-31 04:26:41 0000 -------
Markus, what do you think of this for the next version?

------- Comment #5 From Disenchanted (RETIRED) 2005-06-04 14:43:19 0000 -------
i don;t know about he change to distcc-config

but i surely agree that the exec fullpath-gcc "$@" and exec fullpath-g++ "$@"
scripts should be required to allow proper cross compiling, i didn't test the
distc-config change yet, i simply as suggested by agaffney made gcc and g++ said
scripts, linked CC and C++ to gcc and g++ respectively and now qt and boost
compile as they should since the correct compiler is invoked on the host

if this should be behind a USE flag, so be it :) at least it keeps us from
having to setup manually a working cross compile capable distcc each time we upgrade

if anyone can think of a way to get the ful path/name over to the host w/o
shells, would be great, until then, this is good stuff

------- Comment #6 From Disenchanted (RETIRED) 2005-06-04 14:44:10 0000 -------
sorry, i always forget to add me to CC: with the comment

------- Comment #7 From Disenchanted (RETIRED) 2005-06-12 14:01:09 0000 -------
can i add it then if you are too busy?

------- Comment #8 From Markus Nigbur (RETIRED) 2005-06-12 17:45:03 0000 -------
As I'm too busy with other stuff right now, just go ahead, morfic.

------- Comment #9 From Markus Nigbur (RETIRED) 2005-06-12 17:46:29 0000 -------
reassigning.

------- Comment #10 From Disenchanted (RETIRED) 2005-06-18 12:40:22 0000 -------
2.18.3-r8 is now in portage, thanks Andrew