Opened 7 years ago

Closed 5 years ago

#1559 closed bug (wontfix)

Building multithreaded dlls /MD (=> -D_MT -D_DLL) on Windows using mpich2-1.4.1p1

Reported by: bachmann@… Owned by: jayesh
Priority: major Milestone: future
Component: mpich Keywords: Windows Build

Description (last modified by balaji)


Howto build multithreaded dlls (/MD /MDd) for windows is not documented in windev.pdf.

It would be nice to read there something about "Microsoft HPC Pack 2008 SDK" (SP2) has to be installed as a prerequisite for building MPICH2 on windows (which should not be confused with "HPC Pack 2008 R2 SDK" (SP3) by the way).

Maybe I did something wrong and it is not meant at all for building MPICH2: the delivered MSVS 8.0 solution is is missing paths for building several targets. Especially when it comes to building some non-debug configuration. I gave it a try by trial and error to add the missing include-paths manually but this lead to nothing. The only thing which the solution seems to be good for is building the installer target. Interesting for me was that switching the option /MT => /MD has no impact on the build when executing the batch file makewindist.bat.

Mentioning some important envrionment-variables like:
NODEBUG: => build a release-version
USE_MTDLL_RUNLIB: => build a multi-threaded dll
would also have helped.

Or at least a hint like "Have a look at the generated makefile 'windist/makefile' for advanced configuration options which can be influenced by setting/un-setting some environment-variables."
would have been great.

The only one which has to be defined is "CPU" when running e.g. the batch-file "windist/build.bat" directly. Why would someone would like to do this, when there is the wrapper-script "makewindist.bat"?
Well: When building e.g. a 32Bit version of MPICH2-1.4.1p1 using Visual Studio 2005, there are crashes when executing "makewindist.bat" directly. But when setting up some of the environment variables mentioned above en executing "windist/build.bat" directly, the compilation succeeds.
The unpleasant thing is that the installer project does not find the binaries where it expects them. So I copied them manually to the spots where they where expected and could build the installer. Since I wanted to build dlls and the installer has no knowledge about dlls (they are not configured for packaging) the dlls won't be a part of the package at all.

When building the x64 Bit version using the command-line of Visual Studio 2010, the whole thing is not that problematic. Having configured the build and afterwards converted the MSVS8 solutions (mpich2.sln and examples/examples.sln) to MSVS10, the script "makewindist.bat" does it's job just fine and the x64 Bit installer finds the files for packaging where it expects them (of course: no dlls are packaged).

The script "winconfigure.wsf" offers a option "--remove-fortran" which I thought is great since I did not want the configuration to contain the Fortran parts since I have no Fortran compilers for windows. The bad thing is: when applying the option "--remove-fortran", the defines MPIR_F_TRUE and MPIR_F_FALSE won't be available and compiling will fail. So I did not use this option and deactivated the building of the fortran-parts manually in "makewindist.bat"

Don't get me wrong: I'm really grateful for MPICH2. It is a great library, but I found that the support for the windows version has for sure some room for improvement.

I'm looking forward to a future version of MPICH2 where these pitfalls (at least some of them) have been removed.

Attached you find the archive "building_mpi_multithreaded_dlls_on_windows_(no_fortran_libs).zip" with auxiliary batch- and Cygwin bash-files and patched files of the mpich2-1.4.1.p1 I used to build MPICH2. Maybe there is a more elegant way to build the libraries and maybe some steps are unnecessary but it worked for me.

Perhaps you can use it as a starting point for improvements.

Best regards,


Attachments (1)

building_mpi_multithreaded_dlls_on_windows_(no_fortran_libs).zip (136.5 KB) - added by bachmann@… 7 years ago.
Auxiliary scripts and patches to build a windows version of the MPICH2 binaries.

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by bachmann@…

Auxiliary scripts and patches to build a windows version of the MPICH2 binaries.

comment:1 Changed 7 years ago by jayesh

Most (Almost all) of our users never build MPICH2 on Windows from source. They use the installers provided to install MPICH2.

(PS: Although that does not mean we should have poor documentation :) , that is the reason these kind of documentation has historically got lower priority)


comment:2 Changed 7 years ago by balaji

  • Milestone changed from mpich2-1.5.1 to future
  • Owner set to jayesh
  • Status changed from new to assigned

comment:3 Changed 7 years ago by bachmann@…

When building DEBUG DLLs it would be great to have the *.pdb files named using the same base-name as the DLL itself.

e.g. when building "$(MPE_OUTDIR)\mpe$(D).dll", the option /Fd in the makefile should read:

=> /Fd"$(MPE_OUTDIR)

otherwise all pdb files of all projects will get a default-name like "vc100.pdb" and this makes it impossible to store them in a single folder along with the *.lib and *.dll file for debugging purposes.

comment:4 Changed 5 years ago by balaji

  • Description modified (diff)
  • Resolution set to wontfix
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.