On a Gentoo Linux box which I'm not administering (and to which I don't have root access), how can I find out the options which were used to compile the package?

(Please note I've never worked with Gentoo before, but have good working knowledge of Debian-based distros)

  • The answer by noisebleed is the correct answer. – MattBianco Jan 4 '16 at 7:17

If the portage package manager is used (it most likely is) then the CPU flags can be found in /etc/make.conf as CFLAGS and CXXFLAGS. Note that individual ebuilds may filter certain flags, so the flags you see in /etc/make.conf may not be the ones that were used to compile the package. Looking at the ebuild (under /usr/portage/<category name>/<program name>/) might tell you if that is the case.

This assumes of course that the contents of /etc/make.conf weren't changed after the compilation of the package.

| improve this answer | |
  • /etc/make.conf may not reflect options used when the package was installed. See my answer. – noisebleed Jul 24 '12 at 17:09

Please be aware that current USE flags and other configuration defined in /etc/make.conf may have changed since the package was installed. A more reliable way of checking configuration and compile options is to check var/db/pkg.

Example for apache-2.2.22:

$ cat /var/db/pkg/www-servers/apache-2.2.22-r1/CFLAGS
-mtune=native -O2 -pipe -g
| improve this answer | |

It is important to note that make.conf is not reliable at all, to check how a package is compiled. In fact, it is just one of the supplementary config files in a whole list.

From the man make.conf:

USE_ORDER = "env:pkg:conf:defaults:pkginternal:repo:env.d"
Determines the precedence of layers in the incremental stacking of the USE 
variable. Precedence decreases from left to right such that env overrides 
pkg, pkg overrides conf, and so forth.

So the priority is handled as:

  1. Shell environment when calling emerge
  2. Package specific USE setting in /etc/portage/package.use
  3. make.conf
  4. Defaults from selected profile
  5. Defaults set in package .ebuild file
  6. Distribution defaults
  7. Settings defined in /etc/env.d

So basically an USE flags can be set without being mentioned in make.conf. Likewise for CFLAGS (although their order of processing is fixed, but it works similar)

Likewise, USE flags can be masked in a profile without any in the ebuild or any other sources mentioned above. In short, based on config files you can't.

If you want to know the resulting global settings currently used by the system, use emerge --info. This should give you a massive amount of details. Usually CFLAGS are not very often overridden for a single package,so you can consider that output definitive.

If you want to know the USE flags of a specific package that is installed, you could use equery u <package>, provided the gentoolkit package is installed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.