[mpich-discuss] Trouble linking mpich2 libraries

Dave Goodell goodell at mcs.anl.gov
Wed Oct 19 14:38:18 CDT 2011


If you are going to link by hand with g++ then please be careful.  Make sure that you check the output of "mpicxx -show" to get the library paths and order of libraries correct.  Very subtle bugs can result from botching this order or omitting a piece of it.  The CLIBS line you originally included listed an incorrect ordering.

-Dave

On Oct 19, 2011, at 2:15 PM CDT, Daniel Fulton wrote:

> Hi Dave,
> 
> Thanks for the reponse, and the heads up with CLIBS.  I should be linking with g++ here.
> 
> Compile time problem ended up being another mpi.h located in my petsc include directory.
> 
> Cheers,
> Dan
> 
> 
> On 10/18/2011 12:21 PM, Dave Goodell wrote:
>> Are you actually "#include"ing mpi.h?
>> 
>> Are you certain that you aren't inadvertently picking up a different implementation's mpi.h that does not properly support MPI's C++ bindings?  You might be able to check this by running your failing compile line with the "-M" option added to cause the compiler to output a make dependency rule for all of the header files that were included.
>> 
>> An aside: your problem is compile-time, not link-time, but your "CLIBS" variable has a set of suspicious flags in it.  If you are linking with mpicxx then you should not add "-lmpich" or "-lmpichcxx" to your link line.  Doing so will very likely cause you problems later on.
>> 
>> -Dave
> 



More information about the mpich-discuss mailing list