davidshen84 wrote:My laptop is really old, and compiling gcc could take more than 2 hours. I have another Ubuntu system with gcc-12 and gcc-13 installed. I have configured distcc on both machines, and I can use distcc from my gentoo system and the compilations are distributed on both machines. I am even able to compile my kernel using distcc.
However, I could not compile gcc with distcc. Is it possible to use distcc when compiling gcc?
It is possible, but only for the first of three passes. With most compilers, certainly with gcc, you compile the sources with the system compiler, producing a binary of the new compiler. Then you compile again with the new compiler, producing new compiler #2, functionally equivalent to the first but not identical. Then you compile again with new compiler #2, producing new compiler #3 which should be identical to #2 if everything worked.
Distcc can produce #1, but is out of the loop when building #2 and #3.
You can do what I do: export your old laptop's root (and /var, if separate) by NFS to your faster computer and emerge gcc in a chroot. I cobbled a little script to prepare the chroot, including bind-mounting the helper's /var/tmp/portage on the NFS mount. PM me for details if you need help.
(The two computers have to trust each other ! root access both ways.)