<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Matt,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
-- <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hui Zhou<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> 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</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
@font-face
{font-family:Consolas}
@font-face
{}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:#0563C1;
text-decoration:underline}
span.x_EmailStyle17
{font-family:Consolas;
color:windowtext;
font-weight:normal;
font-style:normal}
.x_MsoChpDefault
{font-size:12.0pt;
font-family:"Calibri",sans-serif}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-family:Consolas">All,</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">I configured mpich as:</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">make[2]: Entering directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> GEN lib/libmpifort.la</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">NAG Fortran Compiler Release 7.0(Yurakucho) Build 7066</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">Option error: Unrecognised option -dynamiclib</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">make[2]: *** [Makefile:7606: lib/libmpifort.la] Error 2</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">make[2]: Leaving directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">make[1]: *** [Makefile:30237: all-recursive] Error 1</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">make[1]: Leaving directory '/Users/mathomp4/src/MPI/mpich-4.0rc3/build-nag-7.0_7066'</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">make: *** [Makefile:7300: all] Error 2</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">I can kind of see places where this is happening. For example in config.status:</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">Now, the interesting thing is this *<b>exact same</b>* issue happened to me with Open MPI:</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"><a href="https://www.mail-archive.com/users@lists.open-mpi.org/msg34635.html">https://www.mail-archive.com/users@lists.open-mpi.org//msg34635.html</a></span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">https://discourse.cmake.org/t/cmake-and-mpi-fortran-cmake-doesnt-see-it/4869</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">Does anyone at MPICH have any thoughts on this?
</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas"> </span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">Thanks,<br>
Matt</span></p>
<p class="x_MsoNormal"><span style="font-family:Consolas">-- </span></p>
<div>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-family:Consolas">Matt Thompson, SSAI, Ld Scientific Programmer/Analyst</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-family:Consolas">NASA GSFC, Global Modeling and Assimilation Office</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-family:Consolas">Code 610.1, 8800 Greenbelt Rd, Greenbelt, MD 20771</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-family:Consolas">Phone: 301-614-6712 Fax: 301-614-6246</span></p>
</div>
<p class="x_MsoNormal"><u><span style="font-family:Consolas; color:#0000E9">http://science.gsfc.nasa.gov/sed/bio/matthew.thompson</span></u></p>
</div>
</div>
</body>
</html>