View previous topic :: View next topic |
Author |
Message |
mortonP Tux's lil' helper
Joined: 22 Dec 2015 Posts: 89
|
Posted: Thu Oct 20, 2022 7:26 am Post subject: fast enable/distable distcc |
|
|
I use an underpowered laptop, but I got a distcc setup running, and compiling chromium with distcc workers drops compile time massively - yay! :-)
Problem is, with my laptop I'm moving around, so when I'm at home I have to compile locally, when I'm at a specific site I can use the extra, unused PCs there and on them VMs with Gentoo as workers...
Now I'm manually editing /etc/portage/make.conf, FEATURES for +distcc and MAKEOPTS to adjust -jx -l2y, and start distcc service.
Questions: Is there a more convenient way to do enable/disable this? Maybe an "emerge --distcc ...." option or something like that, to prevent always editing config files?
Thank you! |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9614 Location: beyond the rim
|
Posted: Thu Oct 20, 2022 9:42 am Post subject: |
|
|
Just add a function in your .profile:
Code: | emerge-distcc() {
FEATURES="$FEATURES distcc" MAKEOPTS="$MAKEOPTS -jX -lY" emerge "$@"
} |
(of course replacing X and Y)
Then call emerge-distcc instead of emerge whenever you want to build with distcc support. |
|
Back to top |
|
|
mortonP Tux's lil' helper
Joined: 22 Dec 2015 Posts: 89
|
Posted: Fri Oct 21, 2022 2:39 pm Post subject: |
|
|
That's a good idea - put it into /root/.bashrc with my other custom stuff:
Code: | emerge-distcc() {
FEATURES="parallel-fetch distcc" MAKEOPTS="-jXX -lY" emerge "$@"
}
|
I don't know whether that also works with .profile and custom additions like FEATURES="$FEATURES distcc".
Thank you!
Hmmm... the Rust-enabled stuff like firefox and thunderbird can also be parallelized/outsourced via sccache? - however once I tried to setup sccache and it failed with an error :-/ ... maybe that got fixed meanwhile? |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22753
|
Posted: Fri Oct 21, 2022 4:09 pm Post subject: |
|
|
Genone specifically wrote FEATURES="$FEATURES features-you-want" so that any preexisting FEATURES environment variable would influence the resulting emerge. Your rewritten version replaces, rather than augments, $FEATURES. Therefore: Code: | FEATURES=nostrip genone-emerge-distcc ... # nostrip is applied
FEATURES=nostrip mortonP-emerge-distcc ... # nostrip is not passed to emerge via FEATURES | One could also write it as: Code: | emerge-distcc() {
FEATURES="distcc $FEATURES" MAKEOPTS="-jX -lY $MAKEOPTS" emerge "$@"
} | This way, an explicit FEATURES=-distcc emerge-distcc would still disable it. That is not useful when the wrapper only changes one FEATURES flag, but if it changed more than one, allowing the user to override part of the implied features, and inherit the rest, could be useful. |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1810 Location: PB, Germany
|
Posted: Thu Nov 17, 2022 7:24 am Post subject: |
|
|
Hi, I have taken your approach defining an emerge-distcc function into my How to share /etc/portage and world file.
This is not only setting FEATURES for distcc but also different CFLAGS to have explicit -march= instead of native. However I wonder that CXXFLAGS also needs to be set although already defined as CXXFLAGS="${CFLAGS}": https://forums.gentoo.org/viewtopic-p-8759259.html#8759259
Any idea why this is the case? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9614 Location: beyond the rim
|
Posted: Thu Nov 17, 2022 8:07 am Post subject: |
|
|
Simple: The CXXFLAGS=$CFLAGS substitution takes place when the corresponding config file is parsed. If you then later override CFLAGS the content of CXXFLAGS no longer references CFLAGS. And that is how it should be. |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1810 Location: PB, Germany
|
Posted: Thu Nov 17, 2022 8:24 am Post subject: |
|
|
Genone wrote: | Simple: The CXXFLAGS=$CFLAGS substitution takes place when the corresponding config file is parsed. If you then later override CFLAGS the content of CXXFLAGS no longer references CFLAGS. And that is how it should be. | Isn't a temporary variable declaration exported to the forked environment of emerge before anything takes place inside there? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9614 Location: beyond the rim
|
Posted: Thu Nov 17, 2022 9:16 am Post subject: |
|
|
The substitution is done by portage itself when parsing the config, the build environment is not involved there and only ever sees the final result. Basically the same if you run "source make.conf" manually.
I'm not exactly sure which syntax elements are supported by portage these days, so if you really want to you may be able to bypass it using a syntax not supported by portage but only the actual shell, e.g. CXXFLAGS="\$(echo \$CFLAGS)" (again, no idea how portage will actually react to that, may take some trial-and-error to figure out the details).
Note that USE and some other special (so-called incremental) variables are treated a bit different, but those are limited to things affecting portage itself. For normal variables the last definition simply overwrites a previous one. |
|
Back to top |
|
|
|