<div>Hi Dave, </div>
<div> </div>
<div> Thanks for the response. Actually I added "-fPIC" to both CFLAGS and CXXFLAGS in my next try. I've always </div>
<div>been building with --enable-shared, and only started adding the flags after I got the error recommending them. But </div>
<div>I still got the error (second one mentioned in the e-mail).</div>
<div> </div>
<div> Yes, my application is being built with "-fPIC" as well. The only fix I found so far is tos specify the link against </div>
<div>the shared object (.so) mpich libraries, instead of static ones. </div>
<div> </div>
<div>Thanks!</div>
<div>--Sunil.<br><br></div>
<div class="gmail_quote">On Fri, Jan 7, 2011 at 11:25 AM, Dave Goodell <span dir="ltr"><<a href="mailto:goodell@mcs.anl.gov">goodell@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Well, you might be able to solve your C++ application build error by using the same workaround you used for C. Add "-fPIC" to your CXXFLAGS when you build MPICH2.<br>
<br>However, that said, it shouldn't be necessary to add those flags to your plain old CFLAGS/CXXFLAGS when building MPICH2 with "--enable-shared". Are you building your application with "-fPIC" as well? If not, then the reason that adding those to MPICH2's build flags fixes your problem is because that flag is then added to the mpicc and mpicxx compiler wrapper scripts.<br>
<br>-Dave<br>
<div>
<div></div>
<div class="h5"><br>On Jan 6, 2011, at 10:24 PM CST, Sunil Thomas wrote:<br><br>> Just to follow-up on this issue; I resolved it by linking instead against the dynamic library<br>> libmpich.so (shared objects files). I am configuring this entirely with cmake and it could<br>
> very well be that I am not specifying the right things in the cmake file (but I still feel the<br>> previous version should work, using the static libs).<br>><br>> Any further thoughts on this will be appreciated..<br>
><br>> --Sunil.<br>><br>> On Thu, Jan 6, 2011 at 8:02 PM, Sunil Thomas <<a href="mailto:sgthomas27@gmail.com">sgthomas27@gmail.com</a>> wrote:<br>> Hi,<br>><br>> First I built mpich2-1.3.1 following the directions in install.pdf doc with --enable-shared<br>
> and the built and install complete successfully but I got the following error when building<br>> my application:<br>><br>> relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object,<br>
> recompile with -fPIC (Could not read symbols: Bad value)<br>><br>><br>> Then I built mpich2-1.3.1 with CFLAGS=-fPIC and --enable-shared and the build and install<br>> again comlpete successfully. (This is on RHEL 5). However when I try to build my application<br>
> using the resulting mpicxx compilers and link to the installed mpich libraries (my application<br>> is written in C++), this time I got the following error:<br>><br>> relocation R_X86_64_32 against `mpifcmb2_' can not be used when making a shared object;<br>
> recompile with -fPIC (Could not read symbols: Bad value)<br>><br>> Greatly appreciate any advice on a fix to the this issue. Let me know if I can provide more<br>> info.<br>><br>> Thanks!<br>> --Sunil.<br>
><br>><br></div></div>> _______________________________________________<br>> mpich-discuss mailing list<br>> <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>> <a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
<br>_______________________________________________<br>mpich-discuss mailing list<br><a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br><a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
</blockquote></div><br>