[mpich-discuss] Help building MPICH as shared library with NAG Fortran and Clang

Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] matthew.thompson at nasa.gov
Tue Jan 18 12:49:55 CST 2022


All,

As the subject says, I'm having issues building MPICH as a shared library with NAG Fortran and Clang on my MacBook.

I configured mpich as:

../configure FCFLAGS="-mismatch_all -fpp" FFLAGS="-mismatch_all -fpp" --prefix=$HOME/installed/Compiler/nag-7.0_7066/mpich/4.0rc3 |& tee configure.nag-7.0_7066.log

where CC=clang, CXX=clang++, and FC=nagfor (set in environment). When I do this, the configure step is fine, but upon build:

make[2]: Entering directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'
  GEN      lib/libmpifort.la
NAG Fortran Compiler Release 7.0(Yurakucho) Build 7066
Option error: Unrecognised option -dynamiclib
make[2]: *** [Makefile:7606: lib/libmpifort.la] Error 2
make[2]: Leaving directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'
make[1]: *** [Makefile:30237: all-recursive] Error 1
make[1]: Leaving directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'
make: *** [Makefile:7300: all] Error 2

The issue seems to be that MPICH (or libtool?) assumes that flags that clang accepts will be accepted by the Fortran compiler as well. But NAG doesn't accept '-dynamiclib' as an option. (I am asking NAG about this as well.)

I can kind of see places where this is happening. For example in config.status:

749:archive_cmds_FC='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring $single_module'

Now, the interesting thing is this *exact same* issue happened to me with Open MPI:

https://www.mail-archive.com/users@lists.open-mpi.org//msg34635.html<https://www.mail-archive.com/users@lists.open-mpi.org/msg34635.html>

On that thread, I eventually figured out how to build Open MPI as static, but now I ran into this:

https://discourse.cmake.org/t/cmake-and-mpi-fortran-cmake-doesnt-see-it/4869

My fear is that if I try and build MPICH as a static library, the same thing will happen.

Does anyone at MPICH have any thoughts on this?

Thanks,
Matt
--
Matt Thompson, SSAI, Ld Scientific Programmer/Analyst
NASA GSFC,    Global Modeling and Assimilation Office
Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771
Phone: 301-614-6712                 Fax: 301-614-6246
http://science.gsfc.nasa.gov/sed/bio/matthew.thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20220118/13b3fba2/attachment.html>


More information about the discuss mailing list