[fpc-devel] MPI (MPICH) - Leopard

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Oct 19 17:10:46 CEST 2008

On 19 Oct 2008, at 13:12, jideel wrote:

> If i try to compile using the following command line : fpc -k/Users/ 
> jideel/mpich2/lib/libmpich.a -k/Users/jideel/mpich2/lib/libpmpich.a  
> HelloWorld1.pp , it builds and executes succesfully.
> I was not aware of this behaviour on Mac OS X.

I don't know whether it is specific to Mac OS X that the linker  
prefers dynamic over static libraries. You were also specifying the  
wrong library name to the linker (mpi rather than mpich). The system- 
installed version is called libmpi, the one you want is libmpich (and  
apparently also libmpich). You might also be able to use {$l  
libmpich.a} and {$l libpmpich.a} in the source (*not* {$linklib  
libmpich.a}) to explicitly refer the static libraries.

> Many thanks for your quick response.
> I removed the openmpi dynamic libs provided with Leopard,

I hope that in the future you will restore this library before  
reporting any problems, as it might be caused by you removing system- 
supplied libraries (including general system instability and what  
not). In general, I would strong recommend against removing system  
libraries (regardless of whether you're on Mac OS X, Linux or Windows).

> do you think i should enable shared libs while building MPICH2 ("-- 
> enable-sharedlibs"), and thus be able to avoid the -k switches ?

That would be an option. But then you will also have to learn about  
library install names on Mac OS X if you intend to distribute your  
program to other people. And at least in this case, simply linking  
against mpich/pmich rather than against mpi will also solve your  


More information about the fpc-devel mailing list