@@ -4,44 +4,58 @@ Specifying compilers and flags
4
4
==============================
5
5
6
6
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
8
8
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 ``:
11
12
12
13
* ``CC ``: C compiler to use
13
14
* ``CFLAGS ``: Compile flags to pass to the C compiler
14
15
* ``CPPFLAGS ``: Preprocessor flags to pass to the C compiler
15
16
* ``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
16
19
* ``FC ``: Fortran compiler to use
17
20
* ``FCFLAGS ``: Compile flags to pass to the Fortran compiler
18
21
* ``LDFLAGS ``: Linker flags to pass to all compilers
19
22
* ``LIBS ``: Libraries to pass to all compilers (it is rarely
20
23
necessary for users to need to specify additional ``LIBS ``)
21
24
* ``PKG_CONFIG ``: Path to the ``pkg-config `` utility
22
25
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 ``:
27
36
28
- For example, to build with a specific instance of GCC::
37
+ .. code-block :: sh
29
38
30
39
shell$ ./configure \
31
40
CC=/opt/gcc-a.b.c/bin/gcc \
32
41
CXX=/opt/gcc-a.b.c/bin/g++ \
33
42
FC=/opt/gcc-a.b.c/bin/gfortran ...
34
43
35
44
Here's another example, this time showing building with the Intel
36
- compiler suite::
45
+ compiler suite:
37
46
38
- shell$ ./configure CC=icc CXX=icpc FC=ifort ...
47
+ .. code-block :: sh
39
48
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.
45
59
46
60
Note that the flags you specify must be compatible across all the
47
61
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
68
82
therefore will produce 64 bit objects for all languages.
69
83
70
84
.. 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 ::
74
91
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 ...
76
96
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.
81
99
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.
84
103
85
104
Note that if you intend to compile Open MPI with a ``make `` other than
86
105
the default one in your ``PATH ``, then you must either set the ``$MAKE ``
0 commit comments