Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] EXTERNAL: Re: Question about compilng with fPIC
From: Tim Prince (n8tm_at_[hidden])
Date: 2011-09-21 13:50:35


On 9/21/2011 12:22 PM, Blosch, Edwin L wrote:
> Thanks Tim.
>
> I'm compiling source units and linking them into an executable. Or perhaps you are talking about how OpenMPI itself is built? Excuse my ignorance...
>
> The source code units are compiled like this:
> /usr/mpi/intel/openmpi-1.4.3/bin/mpif90 -D_GNU_SOURCE -traceback -align -pad -xHost -falign-functions -fpconstant -O2 -I. -I/usr/mpi/intel/openmpi-1.4.3/include -c ../code/src/main/main.f90
>
> The link step is like this:
> /usr/mpi/intel/openmpi-1.4.3/bin/mpif90 -D_GNU_SOURCE -traceback -align -pad -xHost -falign-functions -fpconstant -static-intel -o ../bin/<name> <some libraries> -lstdc++
>
> OpenMPI itself was configured like this:
> ./configure --prefix=/release/cfd/openmpi-intel --without-tm --without-sge --without-lsf --without-psm --without-portals --without-gm --without-elan --without-mx --without-slurm --without-loadleveler --enable-mpirun-prefix-by-default --enable-contrib-no-build=vt --enable-mca-no-build=maffinity --disable-per-user-config-files --disable-io-romio --with-mpi-f90-size=small --enable-static --disable-shared CXX=/appserv/intel/Compiler/11.1/072/bin/intel64/icpc CC=/appserv/intel/Compiler/11.1/072/bin/intel64/icc 'CFLAGS= -O2' 'CXXFLAGS= -O2' F77=/appserv/intel/Compiler/11.1/072/bin/intel64/ifort 'FFLAGS=-D_GNU_SOURCE -traceback -O2' FC=/appserv/intel/Compiler/11.1/072/bin/intel64/ifort 'FCFLAGS=-D_GNU_SOURCE -traceback -O2' 'LDFLAGS= -static-intel'
>
> ldd output on the final executable gives:
> linux-vdso.so.1 => (0x00007fffb77e7000)
> libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b2e2b652000)
> libibverbs.so.1 => /usr/lib64/libibverbs.so.1 (0x00002b2e2b95e000)
> libdl.so.2 => /lib64/libdl.so.2 (0x00002b2e2bb6d000)
> libnsl.so.1 => /lib64/libnsl.so.1 (0x00002b2e2bd72000)
> libutil.so.1 => /lib64/libutil.so.1 (0x00002b2e2bf8a000)
> libm.so.6 => /lib64/libm.so.6 (0x00002b2e2c18d000)
> libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b2e2c3e4000)
> libc.so.6 => /lib64/libc.so.6 (0x00002b2e2c600000)
> libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b2e2c959000)
> /lib64/ld-linux-x86-64.so.2 (0x00002b2e2b433000)
>
> Do you see anything that suggests I should have been compiling the application and/or OpenMPI with -fPIC?
>
If you were building any OpenMPI shared libraries, those should use
-fPIC. configure may have made the necessary additions. If your
application had shared libraries, you would require -fPIC, but
apparently you had none. The shared libraries you show presumably
weren't involved in your MPI or application build, and you must have
linked in static versions of your MPI libraries, where -fPIC wouldn't be
required.

-- 
Tim Prince