[fpc-devel] MPI (MPICH) - Leopard
Jonas Maebe
jonas.maebe at elis.ugent.be
Sat Oct 18 16:07:31 CEST 2008
On 18 Oct 2008, at 14:00, jideel wrote:
> I followed the instructions for using MPICH (1.0.7) located here : http://wiki.freepascal.org/MPICH
> , and it works perfectly under Linux (Centos 5.2) and Win32 (XP).
> However, trying to do the same thing on Leopard (10.5.5) fails.
> First, to compile well, i had to add the following directive :
> {$Linklib mpi} to the HelloWorld1 sample. If i don't, ld outputs :
> "Symbol not found : _MPI_Init" ...: the library cannot be found,
No, on Mac OS X the library is simply not searched without the linklib
statement.
> even if i have added the library path to /etc/fpc.cfg, or if i put
> the library in location already covered by the paths (i checked the
> link.res file). I checked libpmpi.a with nm, and symbols are well
> present
The linker will always prefer a dynamic over a static library if you
simply use {$linklib xxx} (which is equivalent with the linker
parameter -lxxx, which is equivalent on non-Mac OS X FPC platforms
with "procedure test; cdecl; external 'xxx' name 'test';"; but adding
{$linklib xxx} does not hurt on other platforms either).
If you want to link with a static library, you have to specify the
full path name of the file to the linker, using FPC's -k parameter: -
k"/full/path/to/libmpi.a"
> After having added the {$Linklib mpi} directive (or manually change
> the ppaslink.sh file or even directly using ld), it compiles well,
> but can't run.
> Here's the behaviour :
>
> nemes:mpich2 jideel$ mpiexec -n 1 HelloWorld1
> [nemes:00407] *** Process received signal ***
> [nemes:00407] Signal: Segmentation fault (11)
> [nemes:00407] Signal code: Address not mapped (1)
> [nemes:00407] Failing at address: 0x44000088
You are linking against the system-installed version of mpi, which is
not mpich2 (for which the header translation was made). 0x44000000 is
the value of MPI_COMM_WORLD in the mpich2 distribution, but in the
version shipped with Mac OS X MPI_COMM_WORLD is the address of some
symbol instead (and hence you get a segmentation fault when the
program tries to read something from a struct supposedly located at
0x44000000).
Jonas
More information about the fpc-devel
mailing list