Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] LDFLAGS & static compilation & linking
From: Ilias Miroslav (Miroslav.Ilias_at_[hidden])
Date: 2013-04-12 15:53:53


Dear experts,

I would like to prepare static installation of OpenMPI 1.6.4 on Scientific Linux 6 (similar thread here http://www.open-mpi.org/community/lists/users/2012/01/18249.php).

I applied configuration commands:

./configure --prefix=/home/milias/bin/ompi_intel_static CXX=icpc CC=icc F77=ifort FC=ifort --without-memory-manager LDFLAGS=--static THREAD_LDFLAGS=-Wl,--no-export-dynamic --disable-shared --enable-static

and

./configure --prefix=/home/milias/bin/ompi_intel_static CXX=icpc CC=icc F77=ifort FC=ifort --without-memory-manager LDFLAGS=--static --disable-shared --enable-static

but all generated Makefile(s) contain problematic LDFLAGS = -export-dynamic --static. I need either LDFLAGS=--static or LDFLAGS=--static -Wl,--no-export-dynamic.

Why ?

On the Scientific Linux 6 compilation of this short test program, test.c:
int main(int argc, char **argv)
{
        return 0;
}

is crashing:

gcc --static -Wl,--export-dynamic test.c
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie
collect2: ld returned 1 exit status

but "gcc --static test.c" works fine.

This is the failure due to wrong LDFLAGS, which are too many in Makefile(s) to be fixed by hand:

/home/milias/bin/openmpi_intel_static/openmpi-1.6.4/opal/util/if.c:1042: warning: Using 'gethostbyname' in statically linked applications requir es at runtime the shared libraries from the glibc version used for linking
../../../opal/.libs/libopen-pal.a(dlopen.o): In function `vm_open':
/home/milias/bin/openmpi_intel_static/openmpi-1.6.4/opal/libltdl/loaders/dlopen.c:194: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/libc.a(strcmp.o)' c an not be used when making an executable; recompile with -fPIE and relink with -pie
make[2]: *** [opal_wrapper] Error 1
make[2]: Leaving directory `/home/milias/bin/openmpi_intel_static/openmpi-1.6.4/opal/tools/wrappers'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/milias/bin/openmpi_intel_static/openmpi-1.6.4/opal'
make: *** [install-recursive] Error 1

Any help on how to purify LDFLAGS ?

Best, Miro