Vlad, the IM-perler has asked for the wisdom of the Perl Monks concerning the following question:

I am having significant difficulties in installing Parallel::MPI::Simple with openMPI. Despite researching other peoples wisdom on this for several days, I have made little progress - although I have a better understanding of the problem;
Symbols in the Simple.so module are not being found in the openMPI libs, although they plainly exist. I do not understand why - yes I have recompiled everything and run ldconfig.
Any help greatly appreciated, my desperation levels are rising.
For full details, see the post: here
  • Comment on linker/loader problem with Parallel::MPI::Simple

Replies are listed 'Best First'.
Re: linker/loader problem with Parallel::MPI::Simple
by almut (Canon) on Apr 20, 2010 at 08:17 UTC
    perl Makefile.PL CC=mpicc CCFLAGS="-lopenmpi -m64 -L/usr/local/lib/ope +nmpi -L/usr/local/lib/" LIB=/usr/local/lib ... gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions - +fstack-protector --param=ssp-b +uffer-size=4 -m64 -mtune=generic Simple.o -o blib/arch/auto/Parallel +/MPI/Simple/Simple.so \ \ ... - libmpi.so defines the symbol openmpi_mpi_char: ... - However the file Simple.so does not appear to look for this lib: ...

    The problem is that the Simple.so hadn't been linked against libmpi.so, because there was no -lmpi on the above link command line.

    My guess would be that, first, you shouldn't say -lopenmpi, but rather -lmpi (as the lib apparently isn't named libopenmpi.so), and second, this argument shouldn't be in CCFLAGS, but rather in LIBS or LDDLFLAGS, because CCFLAGS is for the compile step, where -lmpi is irrelevant.  (The annoying thing with LDDLFLAGS is that it replaces the defaults (instead of adding to them), so you'd have to manually add whatever perl -V:lddlflags reports.)

    In case that doesn't help, you could simply re-issue the link command manually with the -lmpi appended (plus -L... etc.), rather than trying to convince MakeMaker to automatically issue the commands you want.  I.e. something like

    $ gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions + -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Simp +le.o -o blib/arch/auto/Parallel/MPI/Simple/Simple.so -L/usr/local/l +ib/openmpi -lmpi