building SPRNG with macports gcc45 & mpich2

Ryan Schmidt ryandesign at
Fri Dec 23 01:57:57 PST 2011

On Dec 22, 2011, at 22:45, Gideon Simpson wrote:

> Slightly off topic, but I was wondering if anyone had successfully built SPRNG ( 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

More information about the macports-users mailing list