I'm fairly new to unix and mpich, so please bear with me.<div><br></div><div>I've tried to compile a simple "hello" program below:</div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008b00">
/*The Parallel Hello World Program*/</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623">#include <span style="color: #e00000"><stdio.h></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623">#include <span style="color: #e00000"><mpi.h></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">main(<span style="color: #c800a3">int</span> argc, <span style="color: #c800a3">char</span> **argv)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #c800a3">int</span> node;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #430084">MPI_Init</span>(&argc,&argv);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #430084">MPI_Comm_rank</span><span style="color: #000000">(</span>MPI_COMM_WORLD<span style="color: #000000">, &node);</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">        </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #e00000"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #430084">printf</span><span style="color: #000000">(</span>"Hello World from Node %d\n"<span style="color: #000000">,node);</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">        </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #430084"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>MPI_Finalize<span style="color: #000000">();</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">}</p></div><div><br></div><div>Here is the shell response:</div><div><br></div><div><div>$ gcc main.c -o hello</div><div>Undefined symbols:</div><div> "_MPI_Comm_rank", referenced from:</div>
<div> _main in ccWLoMyo.o</div><div> "_MPI_Finalize", referenced from:</div><div> _main in ccWLoMyo.o</div><div> "_MPI_Init", referenced from:</div><div> _main in ccWLoMyo.o</div><div>
ld: symbol(s) not found</div><div>collect2: ld returned 1 exit status</div></div><div><br></div><div>I tried searching for "MPI_init" in libmpich.a, thinking it might have to do with the added underscore in " _MPI_Init".</div>
<div>Shell response:</div><div><br></div><div><div>$ nm libmpich.a | grep mpi_init</div><div>nm: can't open file: libmpich.a (No such file or directory)</div></div><div><br></div><div>I've added usr/local/lib to the PATH, but still nothing. Any suggestions?</div>
<div><br></div><div>Thanks,</div><div>Sasha</div>