On Mon, Nov 21, 2011 at 6:50 AM, John R. Cary <span dir="ltr"><<a href="mailto:cary@txcorp.com">cary@txcorp.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Brief summary<br>
<br>
PETSc/mingw32-gfortran/HPCPACK (mpich2) fails because<br>
mingw32-gfortran cannot link a simple MPI program.  There<br>
seem also to be some problems with munging of the paths<br>
when using "win32fe cl" for the C/C++ compiler.<br>
<br>
PETSc/mingw32-gfortran/OpenMPI does not have the above<br>
basic link problem, but it fails due to problems with<br>
the PETSc build system.  When using CL (VS10), there are problems<br>
in option translation (path munging).  When using mingw32-gcc/++, there seem<br>
to be failures with the inclusion of some petsc generated<br>
configuration files.<br>
<br>
Longer report<br>
<br>
Attempts to get PETSc-MPI-mingw-gfortran to work:<br>
<br>
HPCPACK (mpich2):<br>
<br>
Ultimately found a problem with the fortran library:<br>
<br>
$ cat conftestf.f<br>
      program main<br>
       include 'mpif.h'<br>
       integer ierr<br>
       call mpi_init(ierr)<br>
      end<br>
$ mingw32-gfortran -o conftestf.o -c conftestf.f -I /winsame/contrib-mingw/<u></u>microsoft-hpc-mingw/Include<br>
xena.cary$ mingw32-gfortran -o conftestf.exe conftestf.o -L/winsame/contrib-mingw/<u></u>microsoft-hpc-mingw/Lib/i386 -lmsmpifec -lmsmpi<br>
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" ' unrecognized<br>
/winsame/contrib-mingw/<u></u>microsoft-hpc-mingw/Lib/i386/<u></u>msmpifec.lib(obj/i386/mpif.<u></u>obj):(.text[_mpi_recv_]+0x1f): undefined reference to `_imp__MPI_F_STATUS_IGNORE'<br>
...<br>
<br>
The missing symbol has a different name in the library,<br>
<br>
$ link /dump /exports "C:\winsame\contrib-mingw\<u></u>microsoft-hpc-mingw\Lib\i386\<u></u>msmpi.lib" | grep F_STATUS_IGNORE<br>
                  _MPI_F_STATUS_IGNORE<br>
<br>
i.e., no _imp_ starting it.<br>
<br>
<br>
OPENMPI (OpenMPI_v1.5.4-win32 binary package)<br>
<br>
  --with-fc='mingw32-gfortran'<br>
<br>
CL and OpenMPI: directories get munged, changes name of libgfortran.a<br>
<br>
  --with-cc='win32fe cl' \<br>
  --with-cxx='win32fe cl' \<br>
  --with-mpi-include=/winsame/<u></u>contrib-mingw/OpenMPI_v1.5.4-<u></u>win32/include \<br>
--with-mpi-lib="[/winsame/<u></u>contrib-mingw/OpenMPI_v1.5.4-<u></u>win32/lib/libmpi_f77d.lib,/<u></u>winsame/contrib-mingw/OpenMPI_<u></u>v1.5.4-win32/lib/libmpi.lib,/<u></u>winsame/contrib-mingw/OpenMPI_<u></u>v1.5.4-win32/lib/libopen-pal.<u></u>lib,/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/lib/<u></u>libopen-rte.lib]" \<br>

<br>
configureDynamicLibraries from PETSc.utilities.<u></u>sharedLibraries(/winsameLINK : fatal error LNK1104: cannot open file 'libgfortran.lib'^M<br>
ret = 512<br>
                      Pushing language C<br>
                      Popping language C<br>
 in /winsame/builds-mingw/<u></u>facetsall-mingw/petsc-3.1-p8/<u></u>par/bin/win32fe/win32fe cl  -o conftest.exe    -MT -wd4996 -O2 -g  conftest.o   -lgfortran -L/winsame/builds-mingw/<u></u>facetsall-mingw/petsc-3.1-p8/<u></u>par/c:/mingw/lib/gcc/mingw32/<u></u>4.6.1 -L/winsame/builds-mingw/<u></u>facetsall-mingw/petsc-3.1-p8/<u></u>par/c:/mingw/lib/gcc -L/winsame/builds-mingw/<u></u>facetsall-mingw/petsc-3.1-p8/<u></u>par/c:/mingw/mingw32/lib -L/winsame/builds-mingw/<u></u>facetsall-mingw/petsc-3.1-p8/<u></u>par/c:/mingw/lib -L/mingw/lib -lgfortran -lmingw32 -lgcc_s -lmoldname -lmingwex -lmsvcrt -lquadmath -lm -ladvapi32 -lshell32 -luser32<br>

Source:<br>
#include "confdefs.h"<br>
#include "conffix.h"<br>
<br>
int main() {<br>
;<br>
  return 0;<br>
}<br>
          Popping language C<br>
      compilers: Cannot compile/link C with /winsame/builds-mingw/<u></u>facetsall-mingw/petsc-3.1-p8/<u></u>par/bin/win32fe/win32fe cl.<br>
<br>
<br>
libgfortran.lib does not exist, but libgfortran.a does.<br>
<br>
<br>
mingw32-gcc and OpenMPI:<br>
<br>
  --with-cc='mingw32-gcc' \<br>
  --with-cxx='mingw32-g++' \<br>
<br>
Directories not munged, but there is something wrong, it seems,<br>
with the includes of PETSc's build system.<br>
<br>
sh: mingw32-g++ -c -o conftest.o  -Wall -Wwrite-strings -Wno-strict-aliasing -O    -I/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/include conftest.cc<br>
Executing: mingw32-g++ -c -o conftest.o  -Wall -Wwrite-strings -Wno-strict-aliasing -O    -I/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/include conftest.cc<br>
sh:<br>
Possible ERROR while running compiler: ret = 256<br>
error message = {In file included from conftest.cc:3:0:^M<br>
/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/include/<u></u>mpi.h:1082:25: error: expected ')' before 'comm'^M<br>
/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/include/<u></u>mpi.h:1096:25: error: expected unqualified-id before 'int'^M<br>
/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/include/<u></u>mpi.h:1096:25: error: expected ')' before 'int'^M<br>
}<br>
Source:<br>
#include "confdefs.h"<br>
#include "conffix.h"<br>
#include <mpi.h><br>
<br>
int main() {<br>
;<br>
  return 0;<br>
}<br>
<br>
Line 1082 is<br>
<br>
OMPI_DECLSPEC  MPI_Fint MPI_Comm_c2f(MPI_Comm comm);<br>
<br>
Line 1096 is<br>
<br>
OMPI_DECLSPEC  MPI_Comm MPI_Comm_f2c(MPI_Fint comm);<br>
<br>
I can compile the above source without the extra conf includes:<br>
<br>
$ cat conftestc.c                                                      #include <mpi.h><br>
<br>
int main() {<br>
;<br>
  return 0;<br>
}<br>
$ mingw32-g++.exe -c -o conftestc.o -O    -I/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/include conftestc.c<br>
$<br>
<br>
BTW, Link with mingw32-g++ fails:<br>
<br>
$ mingw32-g++ -o conftestc.exe conftestc.o  -L/winsame/contrib-mingw/<u></u>OpenMPI_v1.5.4-win32/lib -llibmpi_cxx -llibmpi -llibopen-pal -llibopen-rte        conftestc.o:conftestc.c:(.<u></u>text$_<u></u>ZN3MPI2Op4InitEPFvPKvPviRKNS_<u></u>8DatatypeEEb[MPI::Op::Init(<u></u>void (*)(void const*, void*, int, MPI::Datatype const&), bool)]+0x1b): undefined reference to `ompi_mpi_cxx_op_intercept'<br>

conftestc.o:conftestc.c:(.<u></u>text$_<u></u>ZNK3MPI9Intracomm11Create_<u></u>cartEiPKiPKbb[MPI::Intracomm::<u></u>Create_cart(int, int const*, bool const*, bool) const]+0x81): undefined reference to `MPI::Comm::Comm()'<br>

...<br>
</blockquote></div><br>This is because we could not find these functions and #defined them instead. I would need to see configure.log in order ot understand<div>why they could not be found.</div><div><br></div><div>   Matt<br clear="all">
<div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>
</div>