Opened 9 years ago

Closed 5 years ago

#573 closed bug (wontfix)

Fwd: [mpich-discuss] How to build libmpe.so ?

Reported by: Anthony Chan <chan@…> Owned by: chan
Priority: major Milestone: future
Component: mpich Keywords:
Cc: "Lisandro, Dalcin", <dalcinl@…>

Description (last modified by balaji)


Need to add shared library support eventually....

----- "Seifer Lin" <seiferlin@gmail.com> wrote:

> Hi:
>
> The .so is a wrapper of mpich2 functions.
> MPE is used to output log files for debugging.
>
> Now I just use -fPIC to compile MPE and link libmpe.a into a .so
> file.
>
>
> Seifer
> 2009/5/5 Anthony Chan <chan@mcs.anl.gov>
>
> >
> > Seifer,
> > ----- "Seifer Lin" <seiferlin@gmail.com> wrote:
> >
> >
> > > Now I want to port this DLL to Linux as the .so file.
> > > I try to build mpich with
> > > ./configure --enable-sharedlibs=gcc --with-pm=smpd
> --with-pmi=smpd
> > >
> > > but I only find libmpich.so and libmpe.a.
> > > How to build mpe as the .so (libmpe.so) ?
> >
> > MPE currently does not have shared library support yet.
> > If you really need libmpe.so, you can build MPE as a standalone
> > package for MPICH2 with CFLAGS set to -fPIC.  You can then
> > use the .o files (from libmpe.a) and build your own libmpe.so.
> >
> > To build typical MPI executable, you can mix libmpich.so and
> libmpe.a.
> >
> > > Without libmpe.so, I got the error when building my .so file.
> >
> > What .so file you are building that needs libmpe.so ?
> >
> > A.Chan
> >
> > >
> > > /usr/bin/ld: ./mpich2-x64/src/mpe2/lib/libmpe.a(mpe_log.o):
> > > relocation
> > > R_X86_64_32 against `a local symbol' can not be used when making
> a
> > > shared
> > > object; recompile with -fPIC
> > > ./mpich2-x64/src/mpe2/lib/libmpe.a: could not read symbols: Bad
> value
> > > collect2: ld returned 1 exit status
> > >
> > >
> > > regards,
> > >
> > > Seifer Lin
> >

Change History (7)

comment:1 Changed 9 years ago by Anthony Chan

  • id set to 573

This message has 0 attachment(s)

comment:2 Changed 9 years ago by chan

  • Milestone set to mpich2-1.2
  • Owner set to chan

comment:3 Changed 9 years ago by balaji

  • Milestone changed from mpich2-1.2 to mpich2-1.3

Milestone mpich2-1.2 deleted

comment:4 Changed 9 years ago by chan

  • Cc "Lisandro, Dalcin", <dalcinl@…> added
  • Description modified (diff)

Below is Lisandro Dalcín's description of his problem:


The most relevant link I could found to describe the problems I'm
having is this one:

http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3#doc_chap7

Please, look at this sentence: "On certain architectures (AMD64
amongst them), shared libraries must be "PIC-enabled".

See what it happens when I try to build my "MPE" Python extension
module in Linux 64:

building 'mpi4py.MPE' extension
/usr/local/mpich2/1.1.2/bin/mpicc -pthread -fPIC -fno-strict-aliasing
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_GNU_SOURCE -fPIC -DHAVE_MPE=1 -I/usr/include/python2.5 -c src/MPE.c
-o build/temp.linux-x86_64-2.5/src/MPE.o
/usr/local/mpich2/1.1.2/bin/mpicc -pthread -shared
build/temp.linux-x86_64-2.5/src/MPE.o -L/usr/lib64 -lpython2.5 -o
build/lib.linux-x86_64-2.5/mpi4py/MPE.so -Wl,-whole-archive -llmpe
-Wl,-no-whole-archive -lmpe
/usr/bin/ld: /usr/local/mpich2/1.1.2/lib/liblmpe.a(log_mpi_util.o):
relocation R_X86_64_32 against `a local symbol' can not be used when
making a shared object; recompile with -fPIC
/usr/local/mpich2/1.1.2/lib/liblmpe.a(log_mpi_util.o): could not read
symbols: Bad value
collect2: ld returned 1 exit status

OTOH, MPE work links just fine on Linux 32, despite the fact that the
code what not built with -fPIC (note that this could stop working at
any time in the near future as the MPE codebase changes and text
relocations are required for the final binaries). However, in Linux
64 I simply cannot built a shared lib against static MPE libs built
without -fPIC.

For all this, I'm asking you for consideration to use -fPIC (if the
compiler support it, of course) when MPICH2's configure is asked for
--enable-sharedlibs.

Finally, I think that if MPE properly support shared libs, we could
implement some hackery to pass some option to mpiexec in order to
activate logging of MPI calls at runtime (abusing of LD_PRELOAD
environment variable), without any need for users to recompile their
binaries. This would be similar to what I'm doing in mpi4py, I can
enable MPE logging at runtime using dlopen(..., RTLD_GLOBAL) under the
hood; see for example this Python demo:
http://code.google.com/p/mpi4py/source/browse/trunk/demo/mpe-logging/cpilog.py

comment:5 Changed 8 years ago by chan

  • Description modified (diff)
  • Milestone changed from mpich2-1.3 to mpich2-1.4

comment:6 Changed 7 years ago by balaji

  • Milestone changed from mpich2-1.4 to future

comment:7 Changed 5 years ago by balaji

  • Description modified (diff)
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.