Problem compiling mpi4py

72 views
Skip to first unread message

Thomas Robitaille

unread,
Oct 22, 2009, 10:59:29 AM10/22/09
to mpi4py
Hi,

I'm trying to build mpi4py on a large computer cluster, and am running
into the following error during compilation:

/usr/local/packages/mvapich2-0.98-intel10.1/bin/mpicc -shared build/
temp.linux-x86_64-2.6/src/MPI.o -L/home/packages//python-2.6.2/lib -
lpython2.6 -o build/lib.linux-x86_64-2.6/mpi4py/MPI.so
ld: /usr/local/packages/mvapich2-0.98-intel10.1/lib/libmpich.a
(comm_create_keyval.o): relocation R_X86_64_32 against `MPIR_Process'
can not be used when making a shared object; recompile with -fPIC
/usr/local/packages/mvapich2-0.98-intel10.1/lib/libmpich.a: could not
read symbols: Bad value
error: command '/usr/local/packages/mvapich2-0.98-intel10.1/bin/mpicc'
failed with exit status 1

Does anyone have any idea how to solve this issue? I'm using:

[trobitai@qb1 mpi4py]$ mpicc --version
icc (ICC) 10.1 20070913
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.

[trobitai@qb1 mpi4py]$ python
Python 2.6.2 (r262:71600, Jun 24 2009, 23:49:27)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Thanks for any help,

Thomas

Lisandro Dalcin

unread,
Oct 22, 2009, 4:20:16 PM10/22/09
to mpi4py


On Oct 22, 12:59 pm, Thomas Robitaille <thomas.robitai...@gmail.com>
wrote:
>

Hi.


> ld: /usr/local/packages/mvapich2-0.98-intel10.1/lib/libmpich.a

> (comm_create_keyval.o): relocation R_X86_64_32 against `MPIR_Process'
> can not be used when making a shared object; recompile with -fPIC

You should use a MPI build with shared libraries... mpi4py can still
work with a static MPI lib, but I really recommend you to not do that.
However, this error comes from the linker, it seems that in your
system it is not possible to use a non-PIC static lib to build a
shared one... So in short, you should:

1) Rebuild MPI with support for shared libraries, then rebuild mpi4py,
all should work out of the box.

2) If for some very important reason you still need to stay with a
static lib MPI build, then rebuild your MPI making sure that -fPIC
flag is passed to the compiler, "./configure CFLAGS=-fPIC ... " is
usually enough (or also "export CFLAGS=-fPIC" before "./
configure ...")... However, I have to insist: you do not want to mix
static libraries and Python extension modules, trust me

Reply all
Reply to author
Forward
0 new messages