Rumor has it that thorsten may have mentioned these words:

personally, i found it easier to just leave the machine turned on in a quiet corner, rather than go through re-mounting/chroot each time i want to work on it. i tend to find it serves as a little reminder/motivation too, and it means you can set off the huge compiles and leave the machine working whilst you get on with things like sleep ;)

If this is your first build of LFS I would encourage you to leave the system running, there are too many things which can mess up rebooting the system. Best thing for the first time is to follow the book as straight as possible (assuming you are not very familiar with linux at this time and know what you are doing).

If you have 1) time to tinker a bit before actually starting the LFS build, and 2) another (preferably faster) machine available, there's a program called distcc on the LFS Live CD that can distribute compilations across multiple machines on the network.

I was hoping to have a hint and *maybe* patches to help people use this type of setup by now, but familial duties has unfortunately compromised much of my available free time in the last couple of weeks or so.

However, I can explain the basics in a nutshell:

1) boot your desktop machine and your laptop with a LFS LiveCD (make sure you have the exact same version for both CDs. Altho distcc is normally not very picky about stuff like that, making sure everything's on "the same sheet of music" could nip a problem in the bud later on.)

2) Set up the networking on each machine and either a) assign each an IP address, or if you're using DHCP, find out what IP addresses were assigned to each machine. You're gonna need this later.

2.5) Let's assume for now that your on a trusted network (i.e. no external internet access) and your IPs are 10.10.10/24. Your desktop machine is 10.10.10.2 and your laptop is 10.10.10.3.

3) Set up the environment necessary for distcc. On your desktop machine, start the distcc daemon by typing:
  distccd -a 10.10.10/24

The distcc daemon will complain that there's no 'distcc' user, but it should work anyway.

=-=-=-=-= OK, what follows is what I haven't had a chance to tinker with... you're gonna have to frobnicate with this stuff a bit, methinks... ;-) =-=-=-=-=-=

4) I don't remember if you have to run a copy of the distccd daemon on the client machine (in this case, the laptop) to use it for compilation as well: If so, just start a daemon there using the same command listed above:
  distccd -a 10.10.10/24

5) On your laptop, you're going to have to set up the environment to tell distcc/gcc to be able to use the other machine(s); in this case, you'd need to set an environment variable with the hostnames or ip addresses to all the machines running the distccd daemon:

  export DISTCC_HOSTS='10.10.10.2 10.10.10.3'

The hosts listed in the DISTCC_HOSTS environment variable should be ordered with fastest machines first, and slowest machines last. So if your desktop is much faster (most usually are) you'll want to make sure that IP address is first.

Now, you're going to have to tell all the makefiles to use 'parallel compiling' -- so go into the config/general.ent file, and where you see this:

  <!ENTITY jlevel "">

you'll need to change that entry. There's the easy way, but *may* not work right for all makefiles in the profile. If it doesn't work, don't worry - it won't hurt anything, but you won't get distributed compiling, either. Change the entry to this, and give this a try:

  <!ENTITY jlevel "-j4 CC=distcc">

If the makefile honors the CC environment variable, all is good, and you should be zooming. As far as I know, most if not all should honor this. If that setting above works for all but one or two packages, then I'd say run with it.

However, if you want to *force* distcc usage for all packages, you need to trick the LFS LiveCD environment into thinking it's just running gcc, when in fact it's running distcc. Run these commands:

  mkdir /usr/local/distcc/bin
  cd /usr/local/distcc/bin
  ln -s /usr/bin/distcc gcc
  ln -s /usr/bin/distcc cc
  ln -s /usr/bin/distcc g++
  ln -s /usr/bin/distcc c++

  export PATH=/usr/local/distcc/bin:$PATH

and the change to the config/general.ent file would be:

  <!ENTITY jlevel "-j4">

According to the distcc man page, this is called 'MASQUERADING'. This can be both good and bad, however. Good in that if the makefile is a little diddled up and it doesn't support the CC= environment variable, it can still be parallel compiled. The bad news is, tho, if the package *can't* be parallel compiled due to some other bug and you try to force it this way, it may not build correctly. If you use the masquerading technique, do *not* skip any testing phases of the build!

=-=-=-=-=-=-=

This technique scales quite well, with 4 machines (of similar speed) you'll get about a 3.7x faster compile time IIRC, so if you have more than one machine to access on the network, by all means, use 'em! ;-) If you do, a decent rule of thumb is to set the jlevel number to 2x the number of computers you're using on the network.

[[ If any of the computers are dual processor machines, consider them as two machines for the sake of the jlevel -j number. The LFS LiveCD does support SMP, so you can use all that horsepower! ]]

Of course, these commands are your friend:  ;-)
  distcc --help
  distccd --help
  man distcc
  man distccd

More webpages on distcc:

http://ldp.paradoxical.co.uk/LDP/LGNET/current/simpson.html

http://www-128.ibm.com/developerworks/linux/library/l-distcc.html

Well, back to work... Hope this helps!
Laterz,
Roger "Merch" Merchberger

--
Roger "Merch" Merchberger   | Anarchy doesn't scale well. -- Me
[EMAIL PROTECTED]         |
SysAdmin, Iceberg Computers

--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to