building SPRNG with macports gcc45 & mpich2

Eric A. Borisch eborisch at macports.org
Fri Dec 23 07:06:52 PST 2011


On Fri, Dec 23, 2011 at 3:57 AM, Ryan Schmidt <ryandesign at macports.org> wrote:
>
> On Dec 22, 2011, at 22:45, Gideon Simpson wrote:
>
>> Slightly off topic, but I was wondering if anyone had successfully built SPRNG (http://sprng.cs.fsu.edu/) with a macports based gcc and mpich2.
>>
>> I have gcc45 and mpich+gcc45 installed, and I receive the error:
>>
>> Undefined symbols for architecture x86_64:
>>  "_main", referenced from:
>>      start in crt1.10.5.o
>> ld: symbol(s) not found for architecture x86_64
>> collect2: ld returned 1 exit status
>> if g++ -DHAVE_CONFIG_H -I../SRC -I../include   -DAdd_  -DSPRNG_MPI    -g -O2 -Wno-deprecated -DLONG64=long -MT libsprng_a-sprng.o -MD -MP -MF ".deps/libsprng_a-sprng.Tpo" -c -o libsprng_a-sprng.o `test -f 'sprng.cpp' || echo './'`sprng.cpp; \
>>       then mv -f ".deps/libsprng_a-sprng.Tpo" ".deps/libsprng_a-sprng.Po"; else rm -f ".deps/libsprng_a-sprng.Tpo"; exit 1; fi
>> In file included from sprng.cpp:6:0:
>> communicate.cpp:2:17: fatal error: mpi.h: No such file or directory
>
> Where is the mpi.h header? (I can't seem to build mpich myself.) You probably need to add that directory to CPPFLAGS with an -I argument. For example if it is in /opt/local/include, you need...
>
> export CPPFLAGS=-I/opt/local/include
>
> ...before you begin. Similarly, you probably need to say where the libraries are, e.g. with:
>
> export LDFLAGS=-L/opt/local/lib

Unless you install with +default_mpi, the headers are in
${prefix}/include/mpich2. If you're not using openmpi, I'd recommend
installing with +default_mpi.

You may also want to set your CC and CXX for SPRNG (don't know, never
built, educated guess) to mpicc and mpicxx; these are compiler
wrappers (that wrap macports' gcc45 compilers with the +gcc45 variant)
that get all the correct include (CPPFLAGS) and link (LDFLAGS) paths
for you.

This is the 'preferred' way to build mpi applications - with the wrappers.

Good luck!
 -Eric (mpich2 portfile maintainer)


More information about the macports-users mailing list