7

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)

1
  • The answer by noisebleed is the correct answer.
    – MattBianco
    Commented Jan 4, 2016 at 7:17

3 Answers 3

9

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
3

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.

1

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.

1
  • /etc/make.conf may not reflect options used when the package was installed. See my answer.
    – noisebleed
    Commented Jul 24, 2012 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .