16

I would like to know why when I run gcc -v under Arch Linux, it shows the unknown word in these outputs:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu

while in other distro, like ubuntu it shows the distro name, like, ubuntu:

 Using built-in specs.
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-ubuntu-linux-gnu/5.1.0/lto-wrapper
 Target: x86_64-ubuntu-linux-gnu
3
  • Where did you install this gcc from? May 29, 2015 at 23:26
  • gcc were Installed with the core packages when I was installing Arch.
    – noslin005
    May 30, 2015 at 4:35
  • Ok. Maybe check the compilation instructions for that package, then? May 30, 2015 at 7:37

2 Answers 2

10

As it was already mentioned in the comment, by default the target triplet is generated by config.guess script. It's logic is fairly simple. First it uses uname to get some basic system information:

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

These strings are combined and matched against hardcoded patterns. The result is also hardcoded:

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
...(snip)...
    x86_64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
...(snip)...

For some systems it is possible to give more meaningful result, like IBM in "rs6000-ibm-aix".

Distribution maintainers simply override this string with their own (also hardcoded):

$ gcc -v
...(snip)...
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10'
...(snip)...
--target=x86_64-linux-gnu

GCC 6 will probably output x86_64-pc-linux-gnu by default: updated config.guess in the upstream repository.

2
  • Amazing that GCC 6 is developing.
    – acgtyrant
    Dec 25, 2015 at 7:58
  • 1
    OMG, so unknown is hardcoded by default.
    – acgtyrant
    Dec 25, 2015 at 8:06
6

That's the manufacterer part of the configuration/target triplet. The Autobook says about that:

manufacturer
   A somewhat freeform field which indicates the manufacturer of the system. This is often simply `unknown'. Other common strings are `pc' for an IBM PC compatible system, or the name of a workstation vendor, such as `sun'.

The autoconf manual calls it company.

I'm not an expert in compilation with GCC, but it sounds like the information provided by that field is more of informational nature and unknown is just the default value GCC uses unless explicitly overwritten. GCC on Ubuntu 12.04 for example uses x86_64-linux-gnu, Debian 7s GCC i486-linux-gnu, so it's entirely possible to leave the field empty.

1
  • That's pretty much it. The x86_64-linux-gnu variety are shortcut targets, standing for x86_64-unknown-linux-gnu or x86_64-pc-linux-gnu. gcc -v shows the target it was compiled for, and config.sub gives the canonical triplet (look for it in /usr/share/misc on Debian-derived systems with autotools-dev installed). May 30, 2015 at 8:44

You must log in to answer this question.

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