Request for comments: mpi and using multiple compilers

Sean Farley sean at
Thu Jul 25 14:42:24 PDT 2013

dstrubbe at writes:

> Hi Sean,
> We both have 'arpack @3.1.3+mpich' installed but they were built with
>> two very different compilers: mine with clang and yours with gcc45. If
>> we force the user to specify the compiler then we can use
>> require_active_variants to make sure everything is in line, e.g.
>> arpack +mpich +gfortran -> mpich+gfortran will be used
>> arpack +mpich +gcc45 -> mpich+gcc45 will be used
>> And this ensures that the same compiler is used on all machines with the
>> same variants.
> To me, this seems to complicate life for the user (you are required to
> check what compiler you used for mpich, in order to install this port).
> Also, I can always do "port install mpich +whatever" later on, which
> implicitly deactivates the one I had at the time of building arpack, and
> now the mpich and underlying compiler libraries used in arpack are
> different, and your check does not succeed in enforcing anything about
> that. And, do you see my point that there are other variants involved too,
> which are not being checked? So, the build is still non-reproducible in
> ways that may potentially be important. (For the record, arpack uses only
> Fortran, but this a small detail. I understand the point of your
> example.)

The ability to deactivate a dependent port all goes back to this ticket:

It is quite the hydra that lurks in variants. What I did is write a
script that switches my mpi + compiler variants for all dependent

> BUT: How about this idea which may fit with both of our conceptions of how
> things should work?
> A default variant for fortran is set according to whichever one was used
> for building MPI. Then, you can still do "port install arpack +mpich"
> without worrying which compiler was used to build mpich, but then the
> Portfile will make this actually "arpack +mpich +gcc45" or whatever in the
> registry, so you can report a problem knowing which compiler was used. (And
> in case the user set gcc45 by hand, this will be checked for consistency
> against mpich.)

I've suggested this before but didn't get positive feedback. It would
provide a "closure" of the mpi ports (i.e. they *all* would have a
fortran compiler, so ports like arpack could just specify +mpich and not
have to specify a fortran or compiler variant).

>> It just simply loops through all the fortran variants (gccXY, gfortran,
>> and g95) and returns the one that is set or the empty string if none are
>> set.
> All right, so my suggestion instead is to just see what variant MPI was
> built with, rather than checking against something provided by the user.

I think it's better to error out given the situation and have the user
specify the compiler to use. Of my experience of helping people with
macports in academia, this is the least confusing route.

But really, we're at the whim of what the macports community whats to do
in this situation. Since my Ph.D is riding on getting a working mpi +
fortran, I'd very much like to iron out these issues and get the ports
chugging along!

More information about the macports-dev mailing list