Skip to content

Commit 5feddf9

Browse files
committed
docs compilers-and-flags.rst: minor cleanups
Minor fixes and cleanups to the compilers-and-flags.rst page. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 76c69dd commit 5feddf9

File tree

1 file changed

+44
-25
lines changed

1 file changed

+44
-25
lines changed

docs/installing-open-mpi/compilers-and-flags.rst

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,58 @@ Specifying compilers and flags
44
==============================
55

66
Changing the compilers that Open MPI uses to build itself uses the
7-
standard Autoconf mechanism of setting special environment variables
7+
standard GNU Autoconf mechanism of setting special environment variables
88
either before invoking ``configure`` or on the ``configure`` command
9-
line itself The following environment variables are recognized by
10-
``configure``:
9+
line itself.
10+
11+
The following environment variables are recognized by ``configure``:
1112

1213
* ``CC``: C compiler to use
1314
* ``CFLAGS``: Compile flags to pass to the C compiler
1415
* ``CPPFLAGS``: Preprocessor flags to pass to the C compiler
1516
* ``CXX``: C++ compiler to use
17+
* ``CXXCFLAGS``: Compile flags to pass to the C++ compiler
18+
* ``CXXCPPFLAGS``: Preprocessor flags to pass to the C++ compiler
1619
* ``FC``: Fortran compiler to use
1720
* ``FCFLAGS``: Compile flags to pass to the Fortran compiler
1821
* ``LDFLAGS``: Linker flags to pass to all compilers
1922
* ``LIBS``: Libraries to pass to all compilers (it is rarely
2023
necessary for users to need to specify additional ``LIBS``)
2124
* ``PKG_CONFIG``: Path to the ``pkg-config`` utility
2225

23-
.. note:: Open MPI |ompi_ver| does not contain any C++ code. Hence,
24-
specifying ``CXXFLAGS`` or ``CXXCPPFLAGS`` is useless (but
25-
harmless). The value of ``CC`` is used as the compiler for the
26-
``mpic++`` wrapper compiler, however.
26+
.. note:: Open MPI |ompi_ver| does not contain any C++ code. The only
27+
tests that ``configure`` runs with the C++ compiler is for
28+
the purposes of determining an appropriate value for ``CXX``
29+
to use in the ``mpic++`` :ref:`wrapper compiler
30+
<label-quickstart-building-apps>`. The ``CXXCFLAGS`` and
31+
``CXXCPPFLAGS`` values are *only* used in these
32+
``configure`` checks to ensure that the C++ compiler works.
33+
34+
For example, to build with a specific instance of ``gcc``, ``g++``,
35+
and ``gfortran``:
2736

28-
For example, to build with a specific instance of GCC::
37+
.. code-block:: sh
2938
3039
shell$ ./configure \
3140
CC=/opt/gcc-a.b.c/bin/gcc \
3241
CXX=/opt/gcc-a.b.c/bin/g++ \
3342
FC=/opt/gcc-a.b.c/bin/gfortran ...
3443
3544
Here's another example, this time showing building with the Intel
36-
compiler suite::
45+
compiler suite:
3746

38-
shell$ ./configure CC=icc CXX=icpc FC=ifort ...
47+
.. code-block:: sh
3948
40-
.. note:: We generally suggest using the above command line form for
41-
setting different compilers (vs. setting environment variables and
42-
then invoking ``./configure``). The above form will save all
43-
variables and values in the ``config.log`` file, which makes
44-
post-mortem analysis easier if problems occur.
49+
shell$ ./configure \
50+
CC=icc \
51+
CXX=icpc \
52+
FC=ifort ...
53+
54+
.. note:: The Open MPI community generally suggests using the above
55+
command line form for setting different compilers (vs. setting
56+
environment variables and then invoking ``./configure``). The
57+
above form will save all variables and values in the ``config.log``
58+
file, which makes post-mortem analysis easier if problems occur.
4559

4660
Note that the flags you specify must be compatible across all the
4761
compilers. In particular, flags specified to one language compiler
@@ -68,19 +82,24 @@ The above command line will pass ``-m64`` to all the compilers, and
6882
therefore will produce 64 bit objects for all languages.
6983

7084
.. warning:: Note that setting ``CFLAGS`` (etc.) does *not* affect the
71-
flags used by the wrapper compilers. In the above, example, you
72-
may also need to add ``-m64`` to various ``--with-wrapper-FOO``
73-
options:
85+
flags used by the :ref:`wrapper compilers
86+
<label-quickstart-building-apps>`. In the above, example, you may
87+
also need to add ``-m64`` to various ``--with-wrapper-FOO``
88+
options:
89+
90+
.. code-block::
7491
75-
.. code-block::
92+
shell$ ./configure CFLAGS=-m64 FCFLAGS=-m64 \
93+
--with-wrapper-cflags=-m64 \
94+
--with-wrapper-cxxflags=-m64 \
95+
--with-wrapper-fcflags=-m64 ...
7696
77-
shell$ ./configure CFLAGS=-m64 FCFLAGS=-m64 \
78-
--with-wrapper-cflags=-m64 \
79-
--with-wrapper-cxxflags=-m64 \
80-
--with-wrapper-fcflags=-m64 ...
97+
Failure to do this will result in MPI applications
98+
failing to compile / link properly.
8199

82-
Failure to do this will result in MPI applications failing to
83-
compile / link properly.
100+
See the :ref:`Customizing wrapper compiler behavior
101+
<label-customizing-wrapper-compiler>` section for more
102+
details.
84103

85104
Note that if you intend to compile Open MPI with a ``make`` other than
86105
the default one in your ``PATH``, then you must either set the ``$MAKE``

0 commit comments

Comments
 (0)