# Distcc - so simple in the handbook, where have i gone wrong?

## devilrick

According to the docs emerge distcc 

add distcc to features in make.conf and adjust -j

distcc-config --set-hosts ...

rc-update add distccd default

/etc/init.d/distccd start

and then it should work automatically when using emerge if other similarly set up system as defined in hosts are netowrked to it? Am I missing something, I have received no errors but the compiler output states failed to distribute to [ip] and distccmon-text shows nothing as does distccmon-gnome.

I can find very little on the forums to do with distcc and the docs are limited to those install instructions, and I have no error messages to go on as such. So I appear to be missing some simple config stage or something, any ideas greatly appreciated, you can at least get a laugh at my obvious mistake I must have made  :Rolling Eyes: 

----------

## dejima

you should also add in the /etc/distcc/hosts file the ip of the computers that are going to take part in the distcc

```

10.0.0.1 10.0.0.2

```

place first the one which will first receive the packages for compile

also in the /etc/conf.d/distccd file you should declare which ip you allow to use it and which is the ip of your machine

```

DISTCCD_OPTS="${DISTCCD_OPTS} --allow 10.0.0.1 --allow 10.0.0.2 --listen 10.0.0.2"

```

----------

## Abec

I have have done the steps in the official gentoo distdcc guide and are now having some problems...

I've set up distcc the same way in both mine, and my friends computer

Problem nr 1:

The following line in /etc/conf.d/distccd makes distccd unwilling to start (localhost is 192.168.0.20):

DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.20 --allow 192.168.0.8 --listen 192.168.0.8"

# /etc/init.d/distccd start

* Starting distccd...                                                                                                [ !! ]

And writes no log to the file I've specified in /etc/env.d/02distcc

Problem nr 2:

I figured that allow/listen doesen't really mather because I'm behind a NAT network with only me and one other computer, please correct me if I'm wrong. So I removed the allow/listen flags and the distccd now had no problems starting. But emerge now compiles just as usual and distccmon-text, distccmon-gnome is not showing anything.

Outputs:

# emerge info | grep distcc

distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]

FEATURES="autoaddcvs autoconfig ccache distcc distlocks sandbox sfperms"

# cat /etc/distcc/hosts

192.168.0.20 192.168.0.8

# $PATH

-bash: /usr/lib/ccache/bin:/usr/lib/distcc/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.5:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.2.01/bin:/opt/blackdown-jdk-1.4.2.01/jre/bin:/usr/qt/3/bin:/usr/kde/3.3/sbin:/usr/kde/3.3/bin:No such file or directory

Thankfull for any help on solving this

----------

## hans0r

@devilrick:

distccmon never worked for me, although distcc was running properly.

you can run 'top' on you host-machines to check if they compile stuff tho.

also keep in mind that some packages explicitly don't make use of distcc. it would be fatal if you tried to emerge one of those and falsely conclude that distcc is not working.

----------

## Jimmy Jazz

 *devilrick wrote:*   

> According to the docs emerge distcc 
> 
> add distcc to features in make.conf and adjust -j
> 
> distcc-config --set-hosts ...
> ...

 

Hello,

here is my way  :Smile: 

first you don't need distccd on the client side.

I'm using xinetd. It works great.

emerge --ask --verbose xinetd

dispatch-conf or etc-update if needed. Be careful and don't delete or merge the wrong file !

rc-update add xinetd default

On the server side,

add in /etc/make.conf the following lines,

```

FEATURES="distcc ccache"

DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc"

```

add the PATH environnement in /etc/profile

cat /etc/profile

```

export PATH=/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}

```

it needs to be after ccache pathname

run at the prompt,

```

source /etc/profile or . /etc/profile

```

modify xinetd.conf

cat /etc/xinetd.conf

```
defaults

{

        only_from      = localhost YOUR_LOCAL_NETWORK

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d

```

with YOUR_LOCAL_NETWORK something like 192.168.x.0

copy in /etc/xinetd.d directory a file named distccd

cat /etc/xinetd.d/distccd

```

service distcc

{

        disable         = no

        socket_type     = stream

        wait            = no

        user            = distcc

        server          = /usr/bin/distccd

        protocol        = tcp

        port            = 3632

        bind            = 192.168.1.10

        cps             = 60 10

        server_args     = --inetd --log-file /var/log/distccd.log --log-level warning --verbose --allow YOUR_LOCAL_NETWORK/24 --listen YOUR_LISTENING_INTERFACE 

        nice            = 5

        instances       = 8

        # This makes xinetd cope if there is no service listed in

        # /etc/services

        type            = UNLISTED

}

```

with YOUR_LOCAL_NETWORK like above and YOUR_LISTENING_INTERFACE, the lan card of your computer if you have more than one interface otherwise not needed but it doesn't harm.

kill -HUP XINETD_PROCESS_ID to force xinetd to reread its config files.

On the client side,

modify /etc/distcc/hosts

```

localhost

My_very_fast_super_geil_pc/10

My_very_slow_crate/2

```

The number after the slash means number of process allowed by the server. Put localhost at the end if it is the loser  :Wink: 

to monitor the processes:

DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc" distccmon-gnome

Take in view that some packages doesn't support -j option. Also only one process will be launched at a time. 

ADDENDUM  :Wink: 

Please verify that /usr/lib/distcc/bin contains the following links in the same way as ccache:

```

cd /usr/lib/distcc/bin

ln -s ../../../bin/distcc i686-pc-linux-gnu-c++

ln -s ../../../bin/distcc i686-pc-linux-gnu-g++

ln -s ../../../bin/distcc i686-pc-linux-gnu-gcc

ln -s ../../../bin/distcc gcc

ln -s ../../../bin/distcc g++

ln -s ../../../bin/distcc cc

ln -s ../../../bin/distcc c++

```

of course change i686-pc-linux-gnu with what you have specified in the CHOST flag in make.conf file.

Hope that helps

Jj

----------

## srlinuxx

hey Jimmy, what needs to be done on the machine you want to do all the compiling?  I have this old laptop whose harddrive starts whining when it has to do updates.  I don't want it to have to do any of the compiling and rather let my workhorse do it.  Any advice?  I've tried to set it up a few times and never have succeeded.  I'm gonna try your method when I get home from work tonight.  That poor ole laptop ain't been updated since before last christmas cuz I don't wanna kill that harddrive right now. 

tia, 

-susan

----------

## transient

If you want one machine to do all the compiling, then you need to specify that it should handle all the jobs in the distcc config file on the client, and that the client should handle none of them.

----------

## Jimmy Jazz

 *srlinuxx wrote:*   

> hey Jimmy, what needs to be done on the machine you want to do all the compiling?  I have this old laptop whose harddrive starts whining when it has to do updates.  I don't want it to have to do any of the compiling and rather let my workhorse do it.  Any advice?  I've tried to set it up a few times and never have succeeded.  I'm gonna try your method when I get home from work tonight.  That poor ole laptop ain't been updated since before last christmas cuz I don't wanna kill that harddrive right now. 
> 
> tia, 
> 
> -susan

 

susan,

it is only necessary to configure xinetd on the server. Your client where you execute the emerge needs the above mentioned modifications in /etc/make.conf, /etc/profile and /etc/distcc/hosts.

Please verify that /usr/lib/distcc/bin contains the following links in the same way as ccache:

```

ln -s ../../../bin/distcc i686-pc-linux-gnu-c++

ln -s ../../../bin/distcc  i686-pc-linux-gnu-g++

ln -s ../../../bin/distcc i686-pc-linux-gnu-gcc

ln -s ../../../bin/distcc gcc

ln -s ../../../bin/distcc g++

ln -s ../../../bin/distcc cc

ln -s ../../../bin/distcc c++

```

distcc can only handle some compilations like gcc, g++ but not all the job like linking, java compilations, etc. In the contrary of what transient indicates us (sorry for that  :Wink: ) even when you don't specify localhost in /etc/distcc/hosts it will make some compilations.

The best way to restrain the compilation work on the portable, is to add at the end of the file localhost followed by the number of jobs it can handle

```

localhost/1

```

perhaps, /0 will work... but i have never tried it  :Smile: 

Hope that will help you 

@+

Jj

----------

## transient

/0 does work, except in the case of files that must be compiled on the localhost, like ./configure checks and so on.

----------

## srlinuxx

heyyy, alright, I think it's working.  woohoo.  big thanks to Jimmy.  that's the first time it's ever worked here.  I better copy those instructions for future reference.   :Smile:   that's wonderful, thank you.

----------

## daj

 *Abec wrote:*   

> Problem nr 1:
> 
> The following line in /etc/conf.d/distccd makes distccd unwilling to start (localhost is 192.168.0.20):
> 
> DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.20 --allow 192.168.0.8 --listen 192.168.0.8"
> ...

 

There's your problem: the --listen address should be the address of the server - in your case 192.168.0.20  (strictly, the address of the NIC in the server that should listen for connections from clients - it does nothing if there's only one NIC (unless you get it wrong  :Wink:  )).

--

D.

----------

