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.
Target: x86_64-unknown-linux-gnu

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

 Using built-in specs.
 Target: x86_64-ubuntu-linux-gnu
  • Where did you install this gcc from? – Faheem Mitha May 29 '15 at 23:26
  • gcc were Installed with the core packages when I was installing Arch. – noslin005 May 30 '15 at 4:35
  • Ok. Maybe check the compilation instructions for that package, then? – Faheem Mitha May 30 '15 at 7:37

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:

        echo ${UNAME_MACHINE}-unknown-linux-${LIBC}

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
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10'

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

| improve this answer | |
  • Amazing that GCC 6 is developing. – acgtyrant Dec 25 '15 at 7:58
  • OMG, so unknown is hardcoded by default. – acgtyrant Dec 25 '15 at 8:06

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

   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.

| improve this answer | |
  • 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). – Stephen Kitt May 30 '15 at 8:44

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.