How to interpret the output of gcc -print-multi-li

2019-07-28 03:56发布

问题:

man gcc explains that -print-multi-lib lists switches and how they're separated, but not what e.g.

.;

or

.;
32;@m32
x32;@mx32

could mean. I can't even tell if I have multilib support as requested by https://stackoverflow.com/a/9753955/1797006.

I'm using gcc 5.3.1 and 4.6.3.

回答1:

The output in form: .; without any additional lines means that no multilibs were found on your host.

In general:

-print-multi-lib: This debugging option causes GCC to display the mapping from multilib directory names to compiler switches that enable them. This information is extracted from the specification files used by the compiler, in which the directory name is separated from the switches by a semicolon, and each switch starts with an @ symbol instead of the traditional dash/minus symbol, with no spaces between multiple switches.

Source: The Definitive Guide to GCC by William von Hagen [2nd edition, Apress 2006]. Please notice - this book covers GCC 4.x.y versions but I haven't found any information about some radical changes in this scope in GCC > 5.

Therefore, the second output in your post shows information about two multilibs.

Usage of multilib is typical for cross-compilation purpose.

I think that another quote for the same book is worth mentioning about another useful switch:

-print-multi-directory: This debugging option causes GCC to print the directory name corresponding to the multilib selected by any other switches that are given on the command line. This directory is supposed to exist in the directory defined by the GCC_EXEC_PREFIX environment variable.