[mpich-discuss] MPICH2-1.3.1 libmpich.a: relocation R_X86_64_32 against `mpifcmb2_' can not be used when making a shared object; recompile with -fPIC
Sunil Thomas
sgthomas27 at gmail.com
Fri Jan 7 20:17:46 CST 2011
Thanks Dave,
I think you're probably right. When I tried reproducing the example with a
simple hello world
test taht didnt have the rpath settings of my actual application (and I want
to avoid rebuilding
my application with the old method that resulted in the linker error since
it would take up a lot
of time).
Anyway, if this really becomes an issue, then I will do it and submit - but
for now, I'm happy
it works *some* way..
Thanks again,
--Sunil
On Fri, Jan 7, 2011 at 3:00 PM, Dave Goodell <goodell at mcs.anl.gov> wrote:
> Hmm... I'm not sure I understand why this is happening.
>
> Can you try compiling the failing link step for your application with "-v"
> and send us the output? This should tell us the final library search path
> that the compiler is using when trying to link your application.
>
> This _might_ be an rpath issue. By default, MPICH2 specifies an rpath when
> linking. You can disable the rpath by passing "--disable-rpath" to
> configure and rebuilding+reinstalling. But you'll need to add the installed
> library path to your LD_LIBRARY_PATH (or something equivalent).
>
> -Dave
>
> On Jan 7, 2011, at 3:53 PM CST, Sunil Thomas wrote:
>
> > Hi Dave,
> >
> > Thanks for the response. Actually I added "-fPIC" to both CFLAGS and
> CXXFLAGS in my next try. I've always
> > been building with --enable-shared, and only started adding the flags
> after I got the error recommending them. But
> > I still got the error (second one mentioned in the e-mail).
> >
> > Yes, my application is being built with "-fPIC" as well. The only
> fix I found so far is tos specify the link against
> > the shared object (.so) mpich libraries, instead of static ones.
> >
> > Thanks!
> > --Sunil.
> >
> > On Fri, Jan 7, 2011 at 11:25 AM, Dave Goodell <goodell at mcs.anl.gov>
> wrote:
> > 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.
> >
> > 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.
> >
> > -Dave
> >
> > On Jan 6, 2011, at 10:24 PM CST, Sunil Thomas wrote:
> >
> > > Just to follow-up on this issue; I resolved it by linking instead
> against the dynamic library
> > > libmpich.so (shared objects files). I am configuring this entirely with
> cmake and it could
> > > very well be that I am not specifying the right things in the cmake
> file (but I still feel the
> > > previous version should work, using the static libs).
> > >
> > > Any further thoughts on this will be appreciated..
> > >
> > > --Sunil.
> > >
> > > On Thu, Jan 6, 2011 at 8:02 PM, Sunil Thomas <sgthomas27 at gmail.com>
> wrote:
> > > Hi,
> > >
> > > First I built mpich2-1.3.1 following the directions in install.pdf
> doc with --enable-shared
> > > and the built and install complete successfully but I got the following
> error when building
> > > my application:
> > >
> > > relocation R_X86_64_32 against `a local symbol' can not be used when
> making a shared object,
> > > recompile with -fPIC (Could not read symbols: Bad value)
> > >
> > >
> > > Then I built mpich2-1.3.1 with CFLAGS=-fPIC and --enable-shared and
> the build and install
> > > again comlpete successfully. (This is on RHEL 5). However when I try to
> build my application
> > > using the resulting mpicxx compilers and link to the installed mpich
> libraries (my application
> > > is written in C++), this time I got the following error:
> > >
> > > relocation R_X86_64_32 against `mpifcmb2_' can not be used when making
> a shared object;
> > > recompile with -fPIC (Could not read symbols: Bad value)
> > >
> > > Greatly appreciate any advice on a fix to the this issue. Let me know
> if I can provide more
> > > info.
> > >
> > > Thanks!
> > > --Sunil.
> > >
> > >
> > > _______________________________________________
> > > mpich-discuss mailing list
> > > mpich-discuss at mcs.anl.gov
> > > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> >
> > _______________________________________________
> > mpich-discuss mailing list
> > mpich-discuss at mcs.anl.gov
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> >
> > _______________________________________________
> > mpich-discuss mailing list
> > mpich-discuss at mcs.anl.gov
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110107/f8e3c5c5/attachment-0001.htm>
More information about the mpich-discuss
mailing list