Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#55917 closed defect (fixed)

mpich-gcc7 complains about g++ version mismatch

Reported by: astroboylrx (Rixin Li) Owned by: eborisch (Eric A. Borisch)
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: Cc: seanfarley (Sean Farley)
Port: mpich-gcc7

Description

I installed gcc7 @7.3.0_0 (active) and mpich-gcc7 @3.2.1_3+fortran (active) on my Mac. When I tried to compile an MPI program, an error was returned:

/opt/local/include/mpich-gcc7/mpicxx.h:22:4: error: #error 'Please use the same version of GCC and g++ for compiling MPICH and user MPI programs'
 #  error 'Please use the same version of GCC and g++ for compiling MPICH and user MPI programs'

So I took a look in mpicxx.h, and found

// Check for incompatible GCC versions
// GCC (specifically) g++ changed the calling convention
// between 3.2.3 and 3.4.3 (!!)  Normally such changes
// should only occur at major releases (e.g., version 3 to 4)
#ifdef __GNUC__ 
# if __GNUC__ >= 7 
#  if __GNUC_MINOR__ > 2 && 2 == 2 
#  error 'Please use the same version of GCC and g++ for compiling MPICH and user MPI programs'
#  endif
# endif     
#endif

It looks like a version mismatch of gcc 7.3 with the packaged mpich-gcc7.

Change History (6)

comment:1 Changed 7 years ago by astroboylrx (Rixin Li)

I built mpich-3.2.1 from source with gcc 7.3, which prevents the error. I noticed the relevant code in mpicxx.h becomes

      15 // Check for incompatible GCC versions
      16 // GCC (specifically) g++ changed the calling convention
      17 // between 3.2.3 and 3.4.3 (!!)  Normally such changes
      18 // should only occur at major releases (e.g., version 3 to 4)
      19 #ifdef __GNUC__
      20 # if __GNUC__ >= 7
      21 #  if __GNUC_MINOR__ > 2 && 3 == 2
      22 #  error 'Please use the same version of GCC and g++ for compiling MPICH and user MPI programs'
      23 #  endif
      24 # endif
      25 #endif

Hope this helps a little bit.

comment:2 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: eborisch removed
Keywords: mpich gcc7 removed
Owner: set to eborisch
Status: newassigned

comment:3 Changed 7 years ago by eborisch (Eric A. Borisch)

Resolution: fixed
Status: assignedclosed

In e712544d52b8c81b2335c35c753118155243f2c6/macports-ports:

mpich: revbump *-gcc versions. Add *-clang60.

Fixes #55917

NOTE: The c++ bindings (mpicxx.h) were deprecated in 2009.

comment:4 Changed 7 years ago by astroboylrx (Rixin Li)

Although C++ bindings were deprecated in 2009, mpi.h will include mpicxx.h if __cplusplus is defined and <LANG>_SKIP_MPICXX is not specifically defined.

For example, in mpi.h from openmpi-3.0.0

    2693 /*
    2694  * Conditional MPI 2 C++ bindings support.  Include if:
    2695  *   - The user does not explicitly request us to skip it (when a C++ compiler
    2696  *       is used to compile C code).
    2697  *   - We want C++ bindings support
    2698  *   - We are not building OMPI itself
    2699  *   - We are using a C++ compiler
    2700  */
    2701 #if !defined(OMPI_SKIP_MPICXX) && OMPI_BUILD_CXX_BINDINGS && !OMPI_BUILDING
    2702 #if defined(c_plusplus) || defined(__cplusplus)
    2703 #include "openmpi/ompi/mpi/cxx/mpicxx.h"
    2704 #endif
    2705 #endif

and in mpi.h from MPICH-3.2.1

    2217 #if defined(__cplusplus)
    2218 }
    2219 /* Add the C++ bindings */
    2220 /*
    2221    If MPICH_SKIP_MPICXX is defined, the mpicxx.h file will *not* be included.
    2222    This is necessary, for example, when building the C++ interfaces.  It
    2223    can also be used when you want to use a C++ compiler to compile C code,
    2224    and do not want to load the C++ bindings.  These definitions can
    2225    be made by the C++ compilation script
    2226  */
    2227 #if !defined(MPICH_SKIP_MPICXX)
    2228 /* mpicxx.h contains the MPI C++ binding.  In the mpi.h.in file, this
    2229    include is in an autoconf variable in case the compiler is a C++
    2230    compiler but MPI was built without the C++ bindings */
    2231 #include "mpicxx.h"
    2232 #endif
    2233 #endif

comment:5 Changed 7 years ago by eborisch (Eric A. Borisch)

Indeed. I was mainly raising it for awareness; don't start a new project off using the c++ bindings.

comment:6 Changed 7 years ago by astroboylrx (Rixin Li)

Oh, I see. Yes, good point.

Thank you for fixing it.

Note: See TracTickets for help on using tickets.