Minimizing compilation and installation time

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.
Warning, this page is a work in progress by ris (talk | contribs). Treat its contents with caution.

Most packages will install very quickly on reasonably fast modern hardware, but there are heavier packages, and a few very large ones. Here are some tips to minimize compilation and installation times on Gentoo.

Note that not all packages are compiled, in the usual sense: many are written in interpreted langues such as Python and do not always use a heavy build process. Some packages are installed directly in a precompiled "binary" format.

When installing software, use the --ask --verbose (-av) options and inspect the dependencies that would be pulled in for any large packages that could be replaced by a -bin version, or may even not be needed at all.


  • Tmpfs portage
  • --newuse vs --changes-use
  • SSDs!
  • distcc
  • ccache
  • sync repo with git rather than rsync
  • build and distribute binary packages when working with multiple machines
  • etc.

Avoid unneeded packages

Installing software often pulls in dependencies, and some of these dependencies may be large packages. Inspect what will be installed when emerging, and adjust USE flags to avoid any unneeded dependencies, if possible.


QtWebEngine is a particularly large package that takes a long time to compile. Some packages will pull it in as a dependency by default, but this is not always required or desired.

To avoid having to compile dev-qt/qtwebengine as a dependency for certain packages, add -webengine to make.conf:

FILE /etc/portage/make.conf
USE="pulseaudio -webengine -bluetooth bash-completion"

For some packages, the gui, urlpreview, rss, qt5, pyqt5, dictionary-manager and maybe other USE flags determine QtWebEngine dependency, so it may be useful to watch if theses flags are needed for certain packages or not.

If QtWebEngine has already been pulled in as a dependency, and may now be removed, execute the following commands after modifying make.conf:

root #emaint sync --auto
root #emerge --ask --verbose --update --deep --newuse @world
root #emerge --ask --depclean

Some packages depend unconditionally on QtWebEngine. If these packages are not needed, simply avoid installing them!

For anyone wanting to be absolutely certain to avoid emerging QtWebEngine, consider adding it to /etc/portage/package.mask.

Select compiler options for compilation speed

Some CFLAGS such as -pgo will result in much longer compile times. The pgo USE flag has the same effect.

Alternative binary packages ("-bin" packages)

Some packages have a precompiled alternative, provided by the Gentoo developers. These allow fast installation of packages that otherwise take a particularly long time to compile. Note that the "-bin" packages referred to here are precompiled versions of packages available in the Ebuild repository - there are also binary packages in the repository for other reasons, such as for software that is only available in binary form.

The devs pay great attention to building these versions, there is usually no noticeable performance hit to using them, though usually any difference one way or the other is negligible.

For packages that have USE flags, the "-bin" versions use common defaults. If it is required to change the USE flags for a package, a "-bin" version may not be appropriate, though it is uncommon to have to do so.

These packages are particularly large to compile, just use the "-bin" versions:

Substituting a source based dependency for "-bin" version

When installing a package would pull in a large package that would advantageously be replaced by it's "-bin" version, it is possible to substitute the former for the latter.

When noticing a large packing being pulled in as a dependency, first abort the merge before starting. Then emerge the "-bin" version without adding it to the world file:

root #emerge --oneshot <category>/<package>-bin

Because dependencies on packages that have a "-bin" version are virtual, simply emerge the original package, and the "-bin" version will be used as the dependency.