<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 2 6 3 5 4 5 2 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0in;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:Consolas;
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">Hui,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">Yeah. That is my current thought.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">Now, I do have libtool installed via Brew and maybe that's the issue, but try as I may by moving around that file/symlink, I can't seem to avoid this...or maybe autotools is just *<b>really</b>*
 good at finding it no matter what I do?[1]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">I had hoped maybe the Spack folks had a workaround, but the only nag+mpich patches they have:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><a href="https://github.com/spack/spack/tree/develop/var/spack/repos/builtin/packages/mpich">https://github.com/spack/spack/tree/develop/var/spack/repos/builtin/packages/mpich</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">seem to either be in mpich 4.0rc3 or not related to this!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">Matt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">[1] I thought about `brew uninstall libtool` but that uninstalls a *<b>lot</b>* of other packages. And a brew-less environment sort of breaks my fancy terminal environment! :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas">-- <o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas">Matt Thompson, SSAI, Ld Scientific Programmer/Analyst<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas">NASA GSFC,    Global Modeling and Assimilation Office<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas">Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas">Phone: 301-614-6712                 Fax: 301-614-6246<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><u><span style="font-size:12.0pt;font-family:Consolas;color:#0000E9">http://science.gsfc.nasa.gov/sed/bio/matthew.thompson</span></u><span style="font-size:12.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">"Zhou, Hui" <zhouh@anl.gov><br>
<b>Date: </b>Tuesday, January 18, 2022 at 2:16 PM<br>
<b>To: </b>"discuss@mpich.org" <discuss@mpich.org><br>
<b>Cc: </b>"Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <matthew.thompson@nasa.gov><br>
<b>Subject: </b>[EXTERNAL] Re: Help building MPICH as shared library with NAG Fortran and Clang<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Hi Matt,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">I suspect this is an issue in libtool. We'll take a look at it. We routinely test NAG compiler, but I guess we never tried clang+NAG. Once we figure out the issue, we typically will maintain custom
 patches to libtool until libtool fixes it upstream.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">-- <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Hui Zhou<o:p></o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] via discuss <discuss@mpich.org><br>
<b>Sent:</b> Tuesday, January 18, 2022 12:49 PM<br>
<b>To:</b> discuss@mpich.org <discuss@mpich.org><br>
<b>Cc:</b> Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] <matthew.thompson@nasa.gov><br>
<b>Subject:</b> [mpich-discuss] Help building MPICH as shared library with NAG Fortran and Clang</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xmsonormal"><span style="font-family:Consolas">All,</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">As the subject says, I'm having issues building MPICH as a shared library with NAG Fortran and Clang on my MacBook.
</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">I configured mpich as:</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">../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</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">where CC=clang, CXX=clang++, and FC=nagfor (set in environment). When I do this, the configure step is fine, but upon build:</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">make[2]: Entering directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">  GEN      lib/libmpifort.la</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">NAG Fortran Compiler Release 7.0(Yurakucho) Build 7066</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">Option error: Unrecognised option -dynamiclib</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">make[2]: *** [Makefile:7606: lib/libmpifort.la] Error 2</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">make[2]: Leaving directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">make[1]: *** [Makefile:30237: all-recursive] Error 1</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">make[1]: Leaving directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">make: *** [Makefile:7300: all] Error 2</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">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.)</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">I can kind of see places where this is happening. For example in config.status:</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">749:archive_cmds_FC='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring $single_module'</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">Now, the interesting thing is this *<b>exact same</b>* issue happened to me with Open MPI:</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"><a href="https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mail-archive.com%2Fusers%40lists.open-mpi.org%2Fmsg34635.html&data=04%7C01%7Cmatthew.thompson%40nasa.gov%7C1b3d9ba46d434dc76bea08d9dab71612%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C637781302163806283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ua0iqGGzgrCOF70TeLqZSRambN%2BRkKx5XihYWxyck8U%3D&reserved=0">https://www.mail-archive.com/users@lists.open-mpi.org//msg34635.html</a></span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">On that thread, I eventually figured out how to build Open MPI as static, but now I ran into this:</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">https://discourse.cmake.org/t/cmake-and-mpi-fortran-cmake-doesnt-see-it/4869</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">My fear is that if I try and build MPICH as a static library, the same thing will happen.
</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">Does anyone at MPICH have any thoughts on this?
</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">Thanks,<br>
Matt</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:Consolas">-- </span><o:p></o:p></p>
<div>
<p class="xmsonormal" style="text-autospace:none"><span style="font-family:Consolas">Matt Thompson, SSAI, Ld Scientific Programmer/Analyst</span><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><span style="font-family:Consolas">NASA GSFC,    Global Modeling and Assimilation Office</span><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><span style="font-family:Consolas">Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771</span><o:p></o:p></p>
<p class="xmsonormal" style="text-autospace:none"><span style="font-family:Consolas">Phone: 301-614-6712                 Fax: 301-614-6246</span><o:p></o:p></p>
</div>
<p class="xmsonormal"><u><span style="font-family:Consolas;color:#0000E9">http://science.gsfc.nasa.gov/sed/bio/matthew.thompson</span></u><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>