LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Marc Colosimo (mcolosimo_at_[hidden])
Date: 2004-08-13 15:08:00


On Aug 13, 2004, at 2:51 PM, Jeff Squyres wrote:

> 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?

I have no problems making a simple program.

>> 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?
>

These are needed to create a shared library in apple world. A bundle
can contain a dynamic library (shared library), and a Framework bundle
contains a dynamic library and all the resources that go with that
library.

<http://developer.apple.com/documentation/MacOSX/Conceptual/
SystemOverview/Bundles/chapter_4_section_5.html>

Alright, I finally got it to build and work:

here are the options you need:

-bundle -Wl,-U,_environ (-Wl pass the next option to the linker, -u
pretend the symbol is undefined to force linking, for those like me,
who had to look this up)

Marc