In some cases, it is not possible to use the scripts supplied by mpich for compiling and linking programs. For example, another tool may have its own compilation scripts. In this case, you can use -compile_info and -link_info to have the mpich compilation scripts indicate the compiler flags and linking libraries that are required for correct operation of the mpich routines. For example, when using the ch_shmem device on Solaris systems, the library thread (-lthread) must be linked with the application. If the thread library is not provided, the application will still link, but essential routines will be replaced with dummy versions contained within the Solaris C library, causing the application to fail.
For example, to determine the flags used to compile and link C
programs, you can use these commands, whose output for the
ch_p4 device on a Linux workstation is shown.
% mpicc -compile_info cc -DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1 -I/usr/local/mpich/include -c % mpicc -link_info cc -DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1 -L/usr/local/mpich/lib -lmpich