LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2004-08-13 13:51:59


On Aug 13, 2004, at 2:38 PM, Marc Colosimo wrote:

>>> ldflags := -dynamiclibe -single_module \
>>> -L/usr/local/lib -L/usr/local/lib/lam
>>>
>>> ldlibs := -lmpi -llam_totalview
>>
>> Yikes -- this doesn't seem right.
>>
>> What are you using as your compiler -- are you using mpicc? If you
>> use mpicc, all the "right" flags will be added automatically.
>> Specifically, the -L's and -l's that you need will be added --
>> there's not even a need to add "-lmpi".
>>
>> You can run "mpicc -showme" to show you the Right flags.
>
> % mpicc -showme
> gcc -I/usr/local/include -D_REENTRANT -u
> _lam_darwin_malloc_linker_hack -Wl,-multiply_defined,suppress
> -force_flat_namespace -flat_namespace -Wl,-multiply_defined
> -Wl,suppress -L/usr/local/lib -llammpio -lmpi -llam -ldl

This should be all you need to compile LAM/MPI programs.

>> Specifically -- you should *NOT* be linking to the totalview library.
>> That is a separate shared library that is only loaded by the
>> totalview compiler (it is not linked into MPI executables).
>
> I had to include lam_totalview to get rid of some error (probably
> missing symbols). My ldflags and ldlibs for linux didn't include that
> stuff, but I didn't need to make a dynamic library (it was static).

Can you compile and link a simple "hello world" MPI program with just
mpicc?

#include <stdio.h>
#include <mpi.h>

int main(int argc, char **argv)
{
   int i, rank = 0, size = 0;

   MPI_Init(&argc, &argv);
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
   MPI_Comm_size(MPI_COMM_WORLD, &size);

   printf("Hello, world! I am %d of %d\n", rank, size);

   MPI_Finalize();
   return 0;
}

> After removing the two libraries I still am getting the following for
> -bundle:
> ld: Undefined symbols:
> _environ
>
> And for -dynamic I get:
> ld: Undefined symbols:
> _main

I'm afraid I'm not familiar with -bundle or -dynamic. On the OS X gcc
man page, it says "see ld(1) for more information" about -bundle, but
nothing is listed. Similarly, "-dynamic" says that more information is
available on the dynamic linker page, but I didn't see anything about
it on ld(1).

Do you need these flags? What do they do?

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/