Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using distcc to build Gentoo from stage1
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Jasper
n00b
n00b


Joined: 28 Sep 2002
Posts: 5
Location: Netherlands, the

PostPosted: Sun Jan 05, 2003 11:18 am    Post subject: Using distcc to build Gentoo from stage1 Reply with quote

As I have a rather slow system on which I'm crazy enough to actually bother to install Gentoo(My Pentium MMX 133Mhz laptop), distcc really is quite helpful, and if your system is as slow as mine, and you want to have Gentoo on there as fast as possible(Given that you have other computers to do the work for you of course), just follow these few easy steps ;-)

[edit] Of course if you have some distcc+popt binary packages lying around, you can probably put the correct files on your newly created /mnt/gentoo partition and do the initial bootstrapping using distcc aswell ;-)[/edit]

Unfortunatly, the first stage of the installation still has to be done by the computer, on it's own, so first, after completing the proper preceeding steps, run:

$ cd /usr/portage; scripts/bootstrap.sh

Now we will emerge distcc, which only requires libpopt, so it won't take much time

$ emerge distcc

Now that this is done, we have to run distccd on the client(And on the other machines aswell, but you can read about that in the distcc manual or over here), however, the client won't run as root, and thus we can't start it from our chroot'ed dir, thus, we should go to another shell, log in as root, and create a user there, on the LiveCD

$ groupadd foobar
$ useradd -g foobar -d /home/foobar -s /bin/bash foobar
$ mkdir /home/foobar
$ chown foobar /home/foobar

As we installed distcc in the chrooted shell, we have to do a bit of linking on the LiveCD so we have libpopt which distccd needs, and we throw in a bunch of other libs the LiveCDs doesn't need(You guessed it, this can probably be done better, but in most cases it's not really needed anyway, and this won't give any problems):

$ echo "/mnt/gentoo/usr/lib" >> /etc/ld.so.conf
$ ldconfig

Now we log in as the new user and start the distccd daemon:

$ su foobar
$ /mnt/gentoo/usr/bin/distccd --daemon --log-file=/home/foobar/distcc_log
(Do keep in mind that you don't set the DISTCC_LOG environment variable, as you don't have a /home/foobar/distcc_log in your chrooted shell)

Now if you'd like to watch for any possible errors, or if you're just plain bored, you can tail the logfile:

$ tail -f /home/foobar/distcc_log

Okay, now distccd is up and running :-) Set it up on the other clients aswell, modify, in your chrooted environment, /etc/make.conf and add the proper machines whose speedy hardware you gratiously want make use of(see this site for instructions on how to do this)

Now I don't know if this is the same for everyone, but initially emerging things would simply ignore CC and CXX I specified in make.conf, and I had to modify some /etc profile files aswell, of course if this is just temporary you should set these back when you're finished (Some steps can probably be left out, but I haven't tried that out yet):

/etc/csh.env; Change CC 'gcc' to CC 'distcc' and CXX to 'distcc g++'
/etc/profile.env; Change CC='gcc' to CC='distcc' and CXX to CXX='distcc g++'
/etc/env.d/05gcc; Change CC="gcc" to CC="distcc" and CXX to CXX="distcc g++"

$ env-update
$ source /etc/profile
$ reset (Resets the terminal, not the computer)

And that's it ! Now you can continue your setup(emerge system, and so on) using your fast boxes to do the compiling for you, the duration of your Gentoo installation will hopefully receive a considerable speedup, so that you may be happily tapping away on your newly installed box as soon as possible !

Have fun :-)

- Jasper
Back to top
View user's profile Send private message
El_Presidente_Pufferfish
Veteran
Veteran


Joined: 11 Jul 2002
Posts: 1179
Location: Seattle

PostPosted: Sun Jan 05, 2003 3:16 pm    Post subject: Reply with quote

If my system is already up and running all i have to do is start distccd --daemon as a user on my computers the do the .env file updating and below, right?

edit - i read that link, but now i get
Code:
!!! Invalid token (not "=") DISTCC_HOSTS
!!! Parse error in /etc/make.conf.
!!! Incorrect multiline literals can cause this. Do not use them.

When i try to emerge something
my make.conf reads like this
Code:
export DISTCC_HOSTS="localhost crescens id"
export DISTCC_VERBOSE=1
export MAKEOPTS="-j6"
export CC="distcc"
export CXX="distcc g++"

All of the hostnames are in my /etc/hosts and it errors when i do IP's as well
Back to top
View user's profile Send private message
Jasper
n00b
n00b


Joined: 28 Sep 2002
Posts: 5
Location: Netherlands, the

PostPosted: Sun Jan 05, 2003 7:47 pm    Post subject: Reply with quote

Indeed, seems that site is a bit off, instead of export CC="distcc" and such you should simply put the lines in make.conf without the export, so simply CC="distcc" and such

Hope this helps :-)

- Jasper
Back to top
View user's profile Send private message
lebouf
n00b
n00b


Joined: 14 Jul 2003
Posts: 12
Location: Austin, Texas

PostPosted: Tue Jul 15, 2003 6:09 pm    Post subject: Reply with quote

That fixed things for me. Is there a way to "see" distcc working, becasue emerging seems faster now, I just don't know how to confirm it's not placebo effect
_________________
Clothes do make the man, the world has never been changed by someone in the nude. --Mark Twain
Back to top
View user's profile Send private message
RobMcM
Apprentice
Apprentice


Joined: 11 Jul 2003
Posts: 170
Location: Leeds, UK

PostPosted: Tue Jul 15, 2003 7:49 pm    Post subject: Reply with quote

Instead of modifying CC and CXX, can't you just use 'distcc' in the features section of make.conf to have portage (>2.0.46 I think) automagically use distcc? see https://forums.gentoo.org/viewtopic.php?t=16455&start=25 Cleaner, and easier to change (haven't tried it myself yet but will by the end of the week)
Back to top
View user's profile Send private message
georgz
Tux's lil' helper
Tux's lil' helper


Joined: 06 Dec 2002
Posts: 137
Location: Munich, Germany

PostPosted: Wed Jul 16, 2003 7:52 am    Post subject: Reply with quote

lebouf wrote:
That fixed things for me. Is there a way to "see" distcc working, becasue emerging seems faster now, I just don't know how to confirm it's not placebo effect


You can e.g. do the following:
Code:

# distcc-config --set-log /var/log/distcc.log
# distcc-config --set-verbose 1

(not sure if this one is really needed, you have to try)

Now it logs everything to distcc.log. Be aware that the file can grow big over time.

To see if it spreads jobs around all your machines, do

Code:
# tail -f distcc.log | grep "exec on"


HTH,
Georg
Back to top
View user's profile Send private message
bfdi533
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2003
Posts: 133

PostPosted: Wed Jul 16, 2003 5:55 pm    Post subject: Re: Using distcc to build Gentoo from stage1 Reply with quote

Quote:

Now we will emerge distcc, which only requires libpopt, so it won't take much time.


I have tried this myself thinking this is just the thing I need to speed up my stage 1 install. But, there is no way this is possible for me at this time. When I do an emerge -p distcc I get "pages and pages" of dependencies includeing these:

app-text/docbook-xsl-stylesheets-1.60.1
app-text/docbook-xml-dtd-4.1.2-r3
gnome-base/libglade-2.0.1
gnome-base/libgnomecanvas-2.2.0.2
dev-libs/libxslt-1.0.30-r1
sys-apps/tcp-wrappers-7.6-rc4
gnome-base/gnome-mime-data-2.2.0
gnome-base/gnome-vfs-2.2.4
sys-devel/distcc-2.7.1
...

The list is actually quite long but it is not just libpopt.

Anyone know why there are so many X11 and gnome dependencies on distcc?

Ed
Back to top
View user's profile Send private message
RobMcM
Apprentice
Apprentice


Joined: 11 Jul 2003
Posts: 170
Location: Leeds, UK

PostPosted: Wed Jul 16, 2003 6:38 pm    Post subject: Reply with quote

Quote:
Anyone know why there are so many X11 and gnome dependencies on distcc?


probably because the ebuild has gnome as a dependency, and if your use flags have gnome in them it'll compile it...

This appears to be an error in updating the ebuilds, because according to the distcc website from version 2.7.1 gtk is now required for the graphical distcc monitor, not gnome, but only the latest (2.8.1-r1 +) unstable ebuilds have gtk instead of gnome.

I'm using 2.8.1 because of this, and also because of a 'bug' in the config files: distcc-config sets the hostname, but it doesnt change the entry in /etc/env.d/02distcc which by default includes HOSTNAME="localhost". distcc-config uses /etc/distcc/hosts instead. In other words, no matter what I set as my hosts with distcc-config, it allways used localhost only as the environment variable takes precedence over the hosts file.
(Of course, you could just delete it from the file)
_________________
Keyboard error or no keyboard present. Press F1 to continue.
Back to top
View user's profile Send private message
bfdi533
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2003
Posts: 133

PostPosted: Wed Jul 16, 2003 7:49 pm    Post subject: Reply with quote

Quote:

probably because the ebuild has gnome as a dependency, and if your use flags have gnome in them it'll compile it...


So I were to go into /etc/make.conf and make USE say "-gnome -gtk" then it would handle these dependency problems?

Ed
Back to top
View user's profile Send private message
RobMcM
Apprentice
Apprentice


Joined: 11 Jul 2003
Posts: 170
Location: Leeds, UK

PostPosted: Wed Jul 16, 2003 8:58 pm    Post subject: Reply with quote

Quote:
So I were to go into /etc/make.conf and make USE say "-gnome -gtk" then it would handle these dependency problems?


should do. You wouldn't even have to say -gtk though, just -gnome
_________________
Keyboard error or no keyboard present. Press F1 to continue.
Back to top
View user's profile Send private message
Yarrick
Bodhisattva
Bodhisattva


Joined: 05 Jun 2002
Posts: 304
Location: Malmö, Sweden

PostPosted: Wed Jul 16, 2003 9:08 pm    Post subject: Reply with quote

emerge -pv distcc
shows which USE flags distcc cares about, and their current status
Back to top
View user's profile Send private message
bfdi533
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2003
Posts: 133

PostPosted: Thu Jul 17, 2003 3:04 pm    Post subject: Reply with quote

Yarrick wrote:
emerge -pv distcc
shows which USE flags distcc cares about, and their current status


Sure enough. After setting USE to "-gnome" in /etc/make.conf, emerge -pv distcc now says:

Calculating dependencies ...done!
[ebuild N ] sys-devel/distcc-2.7.1 -gnome

And away I go. Now can do the early stage1 stuff with distcc!!!

Thanks for the tips.

Ed
Back to top
View user's profile Send private message
lisa
Retired Dev
Retired Dev


Joined: 01 Jun 2003
Posts: 273
Location: York, UK again! Horray!

PostPosted: Fri Jul 18, 2003 10:09 pm    Post subject: Reply with quote

bfdi533 wrote:
Yarrick wrote:
emerge -pv distcc
shows which USE flags distcc cares about, and their current status


Sure enough. After setting USE to "-gnome" in /etc/make.conf, emerge -pv distcc now says:

Calculating dependencies ...done!
[ebuild N ] sys-devel/distcc-2.7.1 -gnome

And away I go. Now can do the early stage1 stuff with distcc!!!

Thanks for the tips.

Ed


in 2.7.1 the gnome should have been a gtk. (my error). Its now switched to gtk so gnome won't be pulled in (It wouldn't have been before if you had -gnome anyways).

So to sum up: If you don't want to GUI monitor you will have to put -gtk in your use flags.
_________________
Distcc guide
Visit my website
I maintain Distcc, Ccache, Memcached, and some others (i think)
Back to top
View user's profile Send private message
Veto
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jul 2003
Posts: 83

PostPosted: Sat Jul 19, 2003 12:20 am    Post subject: Reply with quote

Additionally, I wouldn't use the CC="distcc" lines at all. Just make sure that /usr/lib/distcc/bin is in your path before /usr/bin and it'll pick up the distcc/bin/gcc(g++) before the real ones anyway. This will make kernel compiles and other non-portage compile use distcc.

Also, if you have a Windows box that you can throw the default cygwin intall on, you can use the cygwin-linux cross compiler. It's quite simple, do a default install of cygwin (~5min?) and then get my gcc-3.2.3/binutils-2.14xxx/glibc-2.3.2/distcc-2.8 at:

ftp://ftp.dympna.com/cross-linux-3.2.3.tar.bz2 (23MB)

and tar -xvjf into local. Run /usr/local/bin/distccd.sh and you are off and running with a new distcc host. This is really nice for those with a high-speed primary machine and a slackard Gentoo box for playing with.

If you want to get really fancy just add cygrunsrv to your default install (~200k? under admin I think...first menu item on the cygwin installer.) and run /usr/local/bin/mkservice to make it a windows service.
Back to top
View user's profile Send private message
panthar
n00b
n00b


Joined: 01 Sep 2002
Posts: 9

PostPosted: Thu Jul 31, 2003 1:01 pm    Post subject: Reply with quote

When I build it with -gtk, it wants the following packages:

dev-lang/perl
sys-devel/autoconf
sys-devel/flex
sys-apps/miscfiles
sys-libs/cracklib
dev-libs/glib
sys-libs/pwdb
sys-devel/automake
sys-libs/pam
sys-apps/shadow
dev-libs/popt
_________________
There are 11 types of people - those who can count in binary and those who cannot.
Back to top
View user's profile Send private message
christsong84
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1003
Location: GMT-8 (Spokane)

PostPosted: Tue Aug 12, 2003 1:59 pm    Post subject: Reply with quote

ok...question...in the hosts part...do you add the ip of the machine you are compiling for...

e.g. computer1 is a slow computer...running the distccd...this is the computer we are compiling them for. computer 2 is a bit faster and has the distcc client running...so when we add hosts...we add both computer1 and computer2?

I just wanted to be clear on that. :D
_________________
while(true) {self.input(sugar);} :twisted:
Back to top
View user's profile Send private message
lisa
Retired Dev
Retired Dev


Joined: 01 Jun 2003
Posts: 273
Location: York, UK again! Horray!

PostPosted: Tue Aug 12, 2003 4:15 pm    Post subject: Reply with quote

christsong84 wrote:
ok...question...in the hosts part...do you add the ip of the machine you are compiling for...


If you want to use a box for compiling, put it in hosts list. If a computer isn't in the list it won't have code compiled on it. Note that I said "on" and not "for."
_________________
Distcc guide
Visit my website
I maintain Distcc, Ccache, Memcached, and some others (i think)
Back to top
View user's profile Send private message
christsong84
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1003
Location: GMT-8 (Spokane)

PostPosted: Wed Aug 13, 2003 1:50 am    Post subject: Reply with quote

awesome...thx...hopefully adding my P3 1GHz to the machines currently P3 450mhz will speed it up a bit on compiles :D
_________________
while(true) {self.input(sugar);} :twisted:
Back to top
View user's profile Send private message
dontremember
Apprentice
Apprentice


Joined: 21 Sep 2002
Posts: 151
Location: Oklahoma

PostPosted: Thu Aug 14, 2003 7:51 am    Post subject: Reply with quote

lebouf wrote:
That fixed things for me. Is there a way to "see" distcc working, becasue emerging seems faster now, I just don't know how to confirm it's not placebo effect


I'm trying distcc now, and I'm not seeing anything in the monitor window. I am, however, seeing distccd entries in /var/log/syslog on the compile server (the slave doing the compilation)... If you "tail -f /var/log/syslog" on your slave(s), you should see a steady stream of entries like this:

Aug 14 01:30:54 bbcqp02 distccd[2977]: (dcc_check_client) connection from 10.134.11.149:3634
Aug 14 01:30:55 bbcqp02 distccd[2977]: compile from undefined.c to undefined.o
Aug 14 01:30:55 bbcqp02 distccd[2977]: (dcc_r_file_timed) 41751 bytes received in 0.004002s, rate 10188kB/s
Aug 14 01:30:55 bbcqp02 distccd[2977]: (dcc_collect_child) cc times: user 0.070000s, system 0.010000s, 456 minflt, 1003 majflt
Aug 14 01:30:55 bbcqp02 distccd[2977]: cc on localhost completed ok
Back to top
View user's profile Send private message
axxackall
l33t
l33t


Joined: 06 Nov 2002
Posts: 651
Location: Toronto, Ontario, 3rd Rock From Sun

PostPosted: Tue Sep 09, 2003 2:39 am    Post subject: Re: Using distcc to build Gentoo from stage1 Reply with quote

Jasper wrote:
Now that this is done, we have to run distccd on the client(And on the other machines aswell...


Correct me if I am wrong, but you don't have to run distccd on the client if you don't want to use your client as a distcc server for other machines. If it is the case (if you don't want to run distccd on the client) then just make sure that /etc/distcc/hosts has its own host as "localhost" rather than an explicit IP.
_________________
"Lisp is a programmable programming language." - John Foderaro, CACM, September 1991


Last edited by axxackall on Tue Sep 09, 2003 6:53 am; edited 2 times in total
Back to top
View user's profile Send private message
lisa
Retired Dev
Retired Dev


Joined: 01 Jun 2003
Posts: 273
Location: York, UK again! Horray!

PostPosted: Tue Sep 09, 2003 2:47 am    Post subject: Reply with quote

lebouf wrote:
Is there a way to "see" distcc working, becasue emerging seems faster now, I just don't know how to confirm it's not placebo effect


Use the monitors, distccmon-text or distccmon-gnome. They are described in the Guide (see my sig).
_________________
Distcc guide
Visit my website
I maintain Distcc, Ccache, Memcached, and some others (i think)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum