[petsc-dev] Summary of attempts to get PETSc to work with mingw32-gfortran and MPI

Matthew Knepley knepley at gmail.com
Mon Nov 21 08:58:49 CST 2011


On Mon, Nov 21, 2011 at 6:50 AM, John R. Cary <cary at txcorp.com> wrote:

> Brief summary
>
> PETSc/mingw32-gfortran/HPCPACK (mpich2) fails because
> mingw32-gfortran cannot link a simple MPI program.  There
> seem also to be some problems with munging of the paths
> when using "win32fe cl" for the C/C++ compiler.
>
> PETSc/mingw32-gfortran/OpenMPI does not have the above
> basic link problem, but it fails due to problems with
> the PETSc build system.  When using CL (VS10), there are problems
> in option translation (path munging).  When using mingw32-gcc/++, there
> seem
> to be failures with the inclusion of some petsc generated
> configuration files.
>
> Longer report
>
> Attempts to get PETSc-MPI-mingw-gfortran to work:
>
> HPCPACK (mpich2):
>
> Ultimately found a problem with the fortran library:
>
> $ cat conftestf.f
>      program main
>       include 'mpif.h'
>       integer ierr
>       call mpi_init(ierr)
>      end
> $ mingw32-gfortran -o conftestf.o -c conftestf.f -I /winsame/contrib-mingw/
> **microsoft-hpc-mingw/Include
> xena.cary$ mingw32-gfortran -o conftestf.exe conftestf.o
> -L/winsame/contrib-mingw/**microsoft-hpc-mingw/Lib/i386 -lmsmpifec -lmsmpi
> Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" '
> unrecognized
> /winsame/contrib-mingw/**microsoft-hpc-mingw/Lib/i386/**
> msmpifec.lib(obj/i386/mpif.**obj):(.text[_mpi_recv_]+0x1f): undefined
> reference to `_imp__MPI_F_STATUS_IGNORE'
> ...
>
> The missing symbol has a different name in the library,
>
> $ link /dump /exports "C:\winsame\contrib-mingw\**
> microsoft-hpc-mingw\Lib\i386\**msmpi.lib" | grep F_STATUS_IGNORE
>                  _MPI_F_STATUS_IGNORE
>
> i.e., no _imp_ starting it.
>
>
> OPENMPI (OpenMPI_v1.5.4-win32 binary package)
>
>  --with-fc='mingw32-gfortran'
>
> CL and OpenMPI: directories get munged, changes name of libgfortran.a
>
>  --with-cc='win32fe cl' \
>  --with-cxx='win32fe cl' \
>  --with-mpi-include=/winsame/**contrib-mingw/OpenMPI_v1.5.4-**win32/include
> \
> --with-mpi-lib="[/winsame/**contrib-mingw/OpenMPI_v1.5.4-**
> win32/lib/libmpi_f77d.lib,/**winsame/contrib-mingw/OpenMPI_**
> v1.5.4-win32/lib/libmpi.lib,/**winsame/contrib-mingw/OpenMPI_**
> v1.5.4-win32/lib/libopen-pal.**lib,/winsame/contrib-mingw/**
> OpenMPI_v1.5.4-win32/lib/**libopen-rte.lib]" \
>
> configureDynamicLibraries from PETSc.utilities.**sharedLibraries(/winsameLINK
> : fatal error LNK1104: cannot open file 'libgfortran.lib'^M
> ret = 512
>                      Pushing language C
>                      Popping language C
>  in /winsame/builds-mingw/**facetsall-mingw/petsc-3.1-p8/**par/bin/win32fe/win32fe
> cl  -o conftest.exe    -MT -wd4996 -O2 -g  conftest.o   -lgfortran
> -L/winsame/builds-mingw/**facetsall-mingw/petsc-3.1-p8/**
> par/c:/mingw/lib/gcc/mingw32/**4.6.1 -L/winsame/builds-mingw/**
> facetsall-mingw/petsc-3.1-p8/**par/c:/mingw/lib/gcc
> -L/winsame/builds-mingw/**facetsall-mingw/petsc-3.1-p8/**par/c:/mingw/mingw32/lib
> -L/winsame/builds-mingw/**facetsall-mingw/petsc-3.1-p8/**par/c:/mingw/lib
> -L/mingw/lib -lgfortran -lmingw32 -lgcc_s -lmoldname -lmingwex -lmsvcrt
> -lquadmath -lm -ladvapi32 -lshell32 -luser32
> Source:
> #include "confdefs.h"
> #include "conffix.h"
>
> int main() {
> ;
>  return 0;
> }
>          Popping language C
>      compilers: Cannot compile/link C with /winsame/builds-mingw/**
> facetsall-mingw/petsc-3.1-p8/**par/bin/win32fe/win32fe cl.
>
>
> libgfortran.lib does not exist, but libgfortran.a does.
>
>
> mingw32-gcc and OpenMPI:
>
>  --with-cc='mingw32-gcc' \
>  --with-cxx='mingw32-g++' \
>
> Directories not munged, but there is something wrong, it seems,
> with the includes of PETSc's build system.
>
> sh: mingw32-g++ -c -o conftest.o  -Wall -Wwrite-strings
> -Wno-strict-aliasing -O    -I/winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/include
> conftest.cc
> Executing: mingw32-g++ -c -o conftest.o  -Wall -Wwrite-strings
> -Wno-strict-aliasing -O    -I/winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/include
> conftest.cc
> sh:
> Possible ERROR while running compiler: ret = 256
> error message = {In file included from conftest.cc:3:0:^M
> /winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/include/**mpi.h:1082:25:
> error: expected ')' before 'comm'^M
> /winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/include/**mpi.h:1096:25:
> error: expected unqualified-id before 'int'^M
> /winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/include/**mpi.h:1096:25:
> error: expected ')' before 'int'^M
> }
> Source:
> #include "confdefs.h"
> #include "conffix.h"
> #include <mpi.h>
>
> int main() {
> ;
>  return 0;
> }
>
> Line 1082 is
>
> OMPI_DECLSPEC  MPI_Fint MPI_Comm_c2f(MPI_Comm comm);
>
> Line 1096 is
>
> OMPI_DECLSPEC  MPI_Comm MPI_Comm_f2c(MPI_Fint comm);
>
> I can compile the above source without the extra conf includes:
>
> $ cat conftestc.c
>  #include <mpi.h>
>
> int main() {
> ;
>  return 0;
> }
> $ mingw32-g++.exe -c -o conftestc.o -O    -I/winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/include
> conftestc.c
> $
>
> BTW, Link with mingw32-g++ fails:
>
> $ mingw32-g++ -o conftestc.exe conftestc.o  -L/winsame/contrib-mingw/**OpenMPI_v1.5.4-win32/lib
> -llibmpi_cxx -llibmpi -llibopen-pal -llibopen-rte
>  conftestc.o:conftestc.c:(.**text$_**ZN3MPI2Op4InitEPFvPKvPviRKNS_**
> 8DatatypeEEb[MPI::Op::Init(**void (*)(void const*, void*, int,
> MPI::Datatype const&), bool)]+0x1b): undefined reference to
> `ompi_mpi_cxx_op_intercept'
> conftestc.o:conftestc.c:(.**text$_**ZNK3MPI9Intracomm11Create_**
> cartEiPKiPKbb[MPI::Intracomm::**Create_cart(int, int const*, bool const*,
> bool) const]+0x81): undefined reference to `MPI::Comm::Comm()'
> ...
>

This is because we could not find these functions and #defined them
instead. I would need to see configure.log in order ot understand
why they could not be found.

   Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111121/4e0c91e5/attachment.html>


More information about the petsc-dev mailing list