[Beowulf] recompile with -fPIC
Paul Van Allsburg
vanallsburg at hope.edu
Fri Aug 3 05:08:42 PDT 2007
I've been asked to port a Mandelbrot example written in c to perl - to prepare an exercise to get students familiar with the
ideas of writing parallel/distributed code. Perl is what the students will be learning in the course.
I have:
installed MPICH release (1.2.7p1) required by the Perl Parallel:MPI module
installed mpiexec-0.82 from OSC, required interface to PBS
compiled the mandelbrot c code with the MPICH mpicc wrapper and successfully ran it using PBS.
Next steps:
(fail) install the Parallel:MPI code & test,
begin porting the Mandelbrot example...
Im stuck at building the Parallel:MPI code, with a Position Independent Code error
http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3
Here is what happens-
$ make ( of perl module Parallel-MPI-0.03)
mpicc -c -I/usr/local/mpich/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m64 -DVERSION=\"0.03\"
-DXS_VERSION=\"0.03\" -fPIC "-I/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/CORE" -DFLOAT_HACK MPI.c
Running Mkbootstrap for Parallel::MPI ()
chmod 644 MPI.bs
rm -f blib/arch/auto/Parallel/MPI/MPI.so
mpicc -shared MPI.o -o blib/arch/auto/Parallel/MPI/MPI.so
/usr/bin/ld: /usr/local/mpich/lib/libmpich.a(send.o): relocation R_X86_64_32 against `a local symbol' can not be used when
making a shared object; recompile with -fPIC
/usr/local/mpich/lib/libmpich.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Parallel/MPI/MPI.so] Error 1
So I thought I could recover by rebuilding MPICH and add the fPIC flag:
./configure --with-device=ch_p4 --prefix=/usr/local/mpich -cflags=-fPIC
Unfortunately, is doesn't happen.
$ make ( of perl module Parallel-MPI-0.03)
cp MPI.pm blib/lib/Parallel/MPI.pm
AutoSplitting blib/lib/Parallel/MPI.pm (blib/lib/auto/Parallel/MPI)
/usr/bin/perl /usr/lib/perl5/5.8.5/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.5/ExtUtils/typemap -typemap typemap MPI.xs >
MPI.xsc && mv MPI.xsc MPI.c
mpicc -c -I/usr/local/mpich/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m64 -DVERSION=\"0.03\"
-DXS_VERSION=\"0.03\" -fPIC "-I/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/CORE" -DFLOAT_HACK MPI.c
Running Mkbootstrap for Parallel::MPI ()
chmod 644 MPI.bs
rm -f blib/arch/auto/Parallel/MPI/MPI.so
mpicc -shared MPI.o -o blib/arch/auto/Parallel/MPI/MPI.so
/usr/bin/ld: /usr/local/mpich/lib/libmpich.a(initfcmn.o): relocation R_X86_64_32 against `mpipriv_' can not be used when making
a shared object; recompile with -fPIC
/usr/local/mpich/lib/libmpich.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Parallel/MPI/MPI.so] Error 1
What is the correct way to recompile with -fPIC or is there a deeper problem I don't recognize?
Thanks all,
Paul
--
Paul Van Allsburg
Hope College
Holland, Michigan 49423
616-395-7292
More information about the Beowulf
mailing list