Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement --enable-static-runtime configure option. #818

Closed
gpaulsen opened this issue Aug 18, 2015 · 50 comments
Closed

Implement --enable-static-runtime configure option. #818

gpaulsen opened this issue Aug 18, 2015 · 50 comments
Assignees

Comments

@gpaulsen
Copy link
Member

From #729:

Jeff Squyres recommend this approach to solve this type of issue:

I do like the idea of a --enable-static-runtime kind of configure option. This would seem to solve all the problems, and not require the user to know/do anything at runtime.

The only problem is: I'm not entirely sure how to do that.

  1. With the Intel compiler, there's the --static-intel option, but that doesn't make a wholly static orted, for example (it just statically links in the Intel libraries -- not all libraries).
  2. Are there universal options for this for the other compilers?

...after thinking about this for a few minutes, it may be sufficient to do something like this:

if enable_static_runtime was passed
    RUNTIME_LDFLAGS=--static
    if compiler suite is intel
        RUNTIME_LDFLAGS="$RUNTIME_LDFLAGS --static-intel"
    fi
fi

Assuming $(RUNTIME_LDFLAGS) is used when linking the orted (and any other relevant executables?), Libtool might automatically translate --static into whatever is relevant for the underlying compiler, and we only have one special case for the Intel compiler suite.

@jsquyres
Copy link
Member

@gpaulsen Your Github wiki-foo is weak. :-) I updated the description to be proper wiki notation.

@gpaulsen
Copy link
Member Author

😳 I shall aspire to wiki-it-up ❗

@gpaulsen gpaulsen self-assigned this Aug 18, 2015
@ggouaillardet
Copy link
Contributor

fwiw, except having a statically linked orted (or orted that only links with system libs) i do not see how this can be achieved ...
libopen-rte.so, libopen-pal.so and all plugins (if any) need the intel runtime.
so far, i think the only way to achieve the desired result is to have orted binary link with libopen-rte.a, libopen-pal.a and no plugin at all.

@rhc54
Copy link
Contributor

rhc54 commented Aug 19, 2015

That is correct - Brian Barrett had done this a few years back. The key is that you build all of OMPI as static. Today, that still won't build the orted as fully static, so you have to add some magic dust to get that to include all the dependent libs. I don't remember what he had to do - something in the orted Makefile.am plus some configure stuff. You could send him a note and ask - he might remember.

@gpaulsen
Copy link
Member Author

Why must all of OMPI be built static? Why not just link / archive (ar) each of the OMPI pieces against the static compiler runtime libraries? seems like you could still build a liborte.so, but just archive in the static C runtime.

@rhc54
Copy link
Contributor

rhc54 commented Aug 19, 2015

You could try that - I was just relaying what Brian had done. The problem he had was that he built OMPI static, but the orted was not fully static and was still trying to load dependent libs.

@ggouaillardet
Copy link
Contributor

@gpaulsen is that even possible ? if i read you correctly, it means each .so includes the static compiler runtime lib. that would make all the .so very big, plus all symbols would be defined multiple time.
an other option could be to tweak the linker command so libopen-rte.so does not require the intel runtime. i am not sure the linker would allow this (undefined symbol) nor what will happen when linking orted (will the linker pull all the runtime symbols required by libopen-rte.so and not by orted itself, not to mention the plugins ...)

@gpaulsen
Copy link
Member Author

I'd think it'd be possible if you took all of libX's .os and ar'ed them with the compiler runtime .a to create another .a (built PIC of course), and then created a .so from that. I'd think the ar would resolve any of the undefines, but not pickup any symbols that were not needed.
There can be weird other issues though if some "globals" (though possibly not globally scoped) from the compiler runtime exists multiple times in the final executable.

@jsquyres
Copy link
Member

Remember: the goal here is not to make a 100% static orted, but rather just eliminate the need for setting LD_LIBRARY_PATH on remote nodes to find the compiler run-time libraries. The mechanism for doing this -- with the Intel compiler, at least -- just happens to be --static-intel, which statically links in the Intel compiler runtime libraries (vs. dynamically linking them in).

@rhc54
Copy link
Contributor

rhc54 commented Aug 19, 2015

I'm not sure that is completely accurate. We want to eliminate dependencies on any non-standard dynamic libraries. So if you build OMPI against an external hwloc, libevent, or libpmix, then we will also want to pick those up since they might not be installed in the remote LD_LIBRARY_PATH.

Given all the potential combinations, a static orted might be the easiest solution.

@jsquyres
Copy link
Member

FWIW, I stated that the goal was to link in the compiler runtime because we know we can do that. It's easy, low-hanging fruit, and is >90% of the problems we've heard over the years.

It's difficult to make a 100% static orted (or, at least, an orted that is statically linked against libraries in non-standard locations) for the following reasons:

  1. We don't know exactly what "non-standard locations" are for the target machine. The system administrator and/or user could well have set LD_LIBRARY_PATH or /etc/ld.so.conf to point to all the Right places for us.
  2. We'd have to build both static and dynamic OMPI libraries (i.e., libopen-pal and libopen-rte), and then force the orted to link against the .a versions, not the dynamic versions. This is probably do-able, but it'll take some skill/creative workarounds and a bunch of work (i.e., this is not a normal model for Automake, and so you'll have to be creative to make it do that).
  3. It also depends on having static libraries for all of orteds dependencies. E.g., if the user is building against external library X, and there's no libX.a, then we can't statically link it in. That being said, I don't think we have link libX as static -- there's also the option of rpath/runpath-ing libX's dynamic library location into the orted. But that must be done with care, too -- we don't want to rpath/runpath /usr or other well-known library locations (at a minimum). This solution is do-able, but also entails a bit of m4 work.

@ggouaillardet
Copy link
Contributor

I made some tests today, and surprisingly, linking orted with --static is enough, assuming ompi was configure'd with --enable-static. it seems --static-intel is not even necessary since the generated c code does not seem to require the runtime (!)
I will run some more tests and make sure --enable-static-runtime does force --enable-static
(that does not look trivial at first glance, @jsquyres do you know an easy way to achieve this ?)

@jsquyres
Copy link
Member

I'd guess that in the Intel compiler suite, if they see --static, it also enables --static-intel.

I agree that it might be problematic to ensure that if CFLAGS contains --static that OMPI's configure should automatically --enable-static. It might be sufficient for OMPI's configure to error out if CFLAGS contains --static and --enable-static was not specified...?

@gpaulsen
Copy link
Member Author

gpaulsen commented Sep 1, 2015

An Huang on our team came to the conclusion that this is not a low hanging fruit...

Intel has a link https://software.intel.com/en-us/articles/intel-c-compiler-for-linux-statically-linking-intel-provided-libraries-into-your-application says:

By default, some Intel provided libraries are linked dynamically into your application, such as libcxaguard.so. This may not be desired, if you plan to run your application on a system that does not have the Intel C++ Compiler installed on it or you do not want to redistribute the Intel provided libraries with your application.
Use one of the following options to resolve this issue:
-Link all libraries statically using the -static option. This may not be desired since non-Intel libraries are also linked statically, which can cause a significant increase in the size of the executable.
OR
-Link the Intel provided libraries using the -static-intel option. For the 9.1 compiler, use the option -i-static. All other libraries are linked using the default behavior (i.e., system libraries are dynamically linked).

But actually, -static-intel cannot work as expected. I added -static to CFLAGS and CXXFLAGS into Makefile under orte and opal, rebuilt them successfully, but they fail at runtime:
[anzhang@mpi04 bin]$ ldd orterun
linux-vdso.so.1 => (0x00007fffb61c5000)
libm.so.6 => /lib64/libm.so.6 (0x00002b4d0b29e000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b4d0b522000)
librt.so.1 => /lib64/librt.so.1 (0x00002b4d0b726000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b4d0b92e000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b4d0bb31000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b4d0bd47000)
libc.so.6 => /lib64/libc.so.6 (0x00002b4d0bf64000)
/lib64/ld-linux-x86-64.so.2 (0x00002b4d0b07c000)
[anzhang@mpi04 bin]$ orterun
orterun: symbol lookup error: /pmpi2/anzhang/run/ompi.s/lib/openmpi/mca_shmem_mmap.so: undefined symbol: mca_base_component_var_register

building hello.c still has problems:

[anzhang@mpi04 examples]$ make hello_c
mpicc -g hello_c.c -o hello_c

[anzhang@mpi04 examples]$ mpirun -np 4 ./hello_c
mpirun: symbol lookup error: /pmpi2/anzhang/run/ompi.s/lib/openmpi/mca_shmem_mmap.so: undefined symbol: mca_base_component_var_register

Then I tried to build the libmpi.so with LDFLAGS=-static -static-intel, failed with the following problem:
make[5]: Entering directory /pmpi2/anzhang/src/openmpi-1.8.8/ompi/contrib/vt/vt/tools/vtunify/mpi' CXXLD libvt-mpi-unify.la ld: /home/anzhang/anzhang2/src/openmpi-1.8.8/opal/.libs/libopen-pal.a(event.o): relocation R_X86_64_32S againstevent_debug_map_PRIMES' can not be used when making a shared object; recompile with -fPIC
/home/anzhang/anzhang2/src/openmpi-1.8.8/opal/.libs/libopen-pal.a: could not read symbols: Bad value

Building with latest intel compiler still has issues

  1. with LDFLAGS=-static-intel, the result is that it won't get anything linked statically with intel libs just as before.
  2. with LDFLAGS=-static -static-intel, I got the orte/opal statically linked to intel libs, orte depends on opal, so I need to build them the same time.
  3. but compile a mpi application will failed:
    [anzhang@mpi01 examples]$ mpicc hello_c.c
    /pmpi2/anzhang/src/ompi.newest.icc/run/lib/libmpi.so: undefined reference to `_intel_fast_memmove'
  4. orte-info also complains:
    [anzhang@mpi01 bin]$ orte-info
    Open RTE: 1.8.8
    Open RTE repo revision: v1.8.7-20-g1d53995
    Open RTE release date: Aug 05, 2015
    Prefix: /pmpi2/anzhang/src/ompi.newest.icc/run
    Configured architecture: x86_64-pc-linux-gnu
    Configure host: mpi01
    Configured by: anzhang
    Configured on: Mon Aug 31 04:20:54 EDT 2015
    Configure host: mpi01
    Built by: anzhang
    Built on: 2015? 08? 31? ??? 05:05:58 EDT
    Built host: mpi01
    C compiler: icc
    C compiler absolute: /opt/intel/compilers_and_libraries_2016.0.109/linux/bin/intel64/icc
    C compiler family name: INTEL
    C compiler version: 1600.20150815
    Thread support: posix (OPAL: yes, ORTE progress: yes, Event lib: yes)
    Internal debug support: no
    Memory profiling support: no
    Memory debugging support: no
    dl support: yes
    Heterogeneous support: no
    orterun default --prefix: yes
    MPI_WTIME support: gettimeofday
    Symbol vis. support: yes
    FT Checkpoint support: no (checkpoint thread: no)
    orte-info: symbol lookup error: /pmpi2/anzhang/src/ompi.newest.icc/run/lib/openmpi/mca_compress_gzip.so: undefined symbol: mca_base_component_var_register
  5. I tried to build libmpi.so again with LDFLAGS=-static -static-intel due to it depends on orte/opal, but failed again:
    CC patterns/comm/bcast.lo
    CCLD libmpi.la
    ld: /home/anzhang/anzhang2/src/ompi.newest.icc/openmpi-1.8.8/opal/.libs/libopen-pal.a(event.o): relocation R_X86_64_32S against `event_debug_map_PRIMES' can not be used when making a shared object; recompile with -fPIC
    /home/anzhang/anzhang2/src/ompi.newest.icc/openmpi-1.8.8/opal/.libs/libopen-pal.a: could not read symbols: Bad value

@jsquyres
Copy link
Member

jsquyres commented Sep 2, 2015

@gpaulsen I don't think your tests were quite right: you need to link orted and orterun with LDFLAGS=-static-intel. Not CFLAGS or CXXFLAGS.

Here's what I did:

$ ./configure --prefix=/home/jsquyres/bogus CC=icc CXX=icpc FC=ifort  ...
$ make -j 32
# ...
$ cd orte/tools/orted
$ rm orted
$ make install LDFLAGS=-static-intel
# ...
$ cd ../orterun
$ rm orterun
$ make install LDFLAGS=-static-intel
# ...

With these steps, I get a fully functional Open MPI installation (including orted and ortedrun).

All that being said, it looks like the Intel compiler does not link in its runtime statically (even though I verified manually above via make V=1 install LDFLAGS=-static-intel in the orted directory that -static-intel was passed through to the icc invocation line):

$ cd installation_tree/bin
        libimf.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libimf.so (0x00002aaaab63b000)
        libsvml.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libsvml.so (0x00002aaaabaf7000)
        libirng.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libirng.so (0x00002aaaac9ca000)
        libintlc.so.5 => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libintlc.so.5 (0x00002aaaacbd1000)

I can even see this when compiling MPI "hello world":

# Plain build
$ mpicc hello_c.c -o hello
$ ldd hello | grep intel
        libimf.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libimf.so (0x00002aaaabaef000)
        libsvml.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libsvml.so (0x00002aaaabfaa000)
        libirng.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libirng.so (0x00002aaaace7d000)
        libintlc.so.5 => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libintlc.so.5 (0x00002aaaad085000)

# Build with -static-intel
$ mpicc hello_c.c -o hello -static-intel
icc: warning #10237: -lcilkrts linked in dynamically, static library not available
$ ldd hello | grep intel
        libimf.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libimf.so (0x00002aaaabaef000)
        libsvml.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libsvml.so (0x00002aaaabfaa000)
        libirng.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libirng.so (0x00002aaaace7d000)
        libintlc.so.5 => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libintlc.so.5 (0x00002aaaad085000)

You can see that building "hello world" with and without -static-intel results in dynamic Intel runtime libraries.

Perhaps this is an Intel compiler bug...?

@rhc54
Copy link
Contributor

rhc54 commented Sep 2, 2015

@jsquyres surely you jest... :-)

@rhc54
Copy link
Contributor

rhc54 commented Sep 2, 2015

@hppritcha is this something you could ask your friends there at the COE?

@anhzhang
Copy link

anhzhang commented Sep 2, 2015

Hello, this is An Huang :)
"make install LDFLAGS=-static-intel" won't get orted statically linked to intel libs, it gives a warning:

$ make install LDFLAGS=-static-intel
CCLD orted
icc: warning #10237: -lcilkrts linked in dynamically, static library not available
make[1]: Entering directory /pmpi2/anzhang/src/ompi.newest.icc/src/openmpi-1.8.8.common/orte/tools/orted' /bin/mkdir -p '/pmpi2/anzhang/src/ompi.newest.icc/run/common/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c orted '/pmpi2/anzhang/src/ompi.newest.icc/run/common/bin' libtool: install: /usr/bin/install -c .libs/orted /pmpi2/anzhang/src/ompi.newest.icc/run/common/bin/orted /bin/mkdir -p '/pmpi2/anzhang/src/ompi.newest.icc/run/common/share/man/man1' /usr/bin/install -c -m 644 orted.1 '/pmpi2/anzhang/src/ompi.newest.icc/run/common/share/man/man1' make[1]: Leaving directory/pmpi2/anzhang/src/ompi.newest.icc/src/openmpi-1.8.8.common/orte/tools/orted'

$ ldd /pmpi2/anzhang/src/ompi.newest.icc/run/common/bin/orted
linux-vdso.so.1 => (0x00007fff199ff000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/common/lib/libopen-rte.so.7 (0x00002b52d5eb6000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/common/lib/libopen-pal.so.6 (0x00002b52d614c000)
libm.so.6 => /lib64/libm.so.6 (0x00002b52d646d000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b52d66f1000)
librt.so.1 => /lib64/librt.so.1 (0x00002b52d68f6000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b52d6afe000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b52d6d01000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b52d6f18000)
libc.so.6 => /lib64/libc.so.6 (0x00002b52d7135000)
libimf.so => /opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64/libimf.so (0x00002b52d74c9000)
libsvml.so => /opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64/libsvml.so (0x00002b52d79c2000)
libirng.so => /opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64/libirng.so (0x00002b52d8881000)
libintlc.so.5 => /opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64/libintlc.so.5 (0x00002b52d8a89000)
/lib64/ld-linux-x86-64.so.2 (0x00002b52d5c94000)

@ggouaillardet
Copy link
Contributor

as discussed in #829 can you try to configure with
LDFLAGS=-Wc,-static-intel
an run make && make install again
fwiw, it is generally not a good idea to set LDFLAGS and friends at compile time
at first glance, it seems orted does not even require the intel runtime, and linking with it looks like an overkill here

@anhzhang
Copy link

anhzhang commented Sep 2, 2015

Ah, you're correct!, @ggouaillardet , thanks!
The option -static-intel should be set for icc, so "LDFLAGS=-static-intel" won't work, and the right way is: ./configure --prefix=... s CC=icc CXX=icpc FC=ifort LDFLAGS=-Wc,-static-intel

@jsquyres
Copy link
Member

jsquyres commented Sep 2, 2015

@ggouaillardet They're testing with setting LDFLAGS at build time because the suggestion was to just set those flags for just the orted and orterun. It was a quick-n-dirty way to test the idea without doing all the configury work.

That being said, -Wc,-static-intel doesn't work for me. For example:

$ mpicc hello_c.c -o hello -Wc,-static-intel
icc: command line warning #10006: ignoring unknown option '-Wc,-static-intel'

I have a fairly recent version of the Intel compiler:

$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.3.187 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

@ggouaillardet
Copy link
Contributor

got it, thanks
we need -Wc,-static-intel because -static-intel is not passed to icc by libtool
(-Wc, is a libtool thing, not an icc one)
obviously, mpicc is not using libtool, and there is also no need to pass -static-intel to icc,
so I guess we should add --with-wrappers-ldflags="" to the configure command line
(I am not sure of the syntax, and will not be able to test this before tomorrow)

@jsquyres
Copy link
Member

jsquyres commented Sep 2, 2015

@ggouaillardet See my comment, above -- even when I pass -static-intel to mpicc, the resulting executable does not have static linkage of the Intel runtime.

Additionally, when I passed LDFLAGS=-static-intel to the build for orted and orterun, Libtool passed it on the command line properly. But still, the intel runtime libs are linked dynamically, not statically:

$ cd orte/tools/orted
$ rm orted
$ make V=1 LDFLAGS=-static-intel
/bin/sh ../../../libtool  --tag=CC   --mode=link icc -std=gnu99  -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread  -static-intel -o orted orted.o ../../../orte/libopen-rte.la ../../../opal/libopen-pal.la -lrt -lutil   -lrt -lutil  
libtool: link: icc -std=gnu99 -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread -static-intel -o .libs/orted orted.o  ../../../orte/.libs/libopen-rte.so /home/jsquyres/git/ompi/opal/.libs/libopen-pal.so ../../../opal/.libs/libopen-pal.so -lm -lnuma -lpciaccess -ldl -lrt -lutil -pthread -Wl,-rpath -Wl,/home/jsquyres/bogus/lib
icc: warning #10237: -lcilkrts linked in dynamically, static library not available
$ ldd .libs/orted | grep intel
        libimf.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libimf.so (0x00002aaaab63b000)
        libsvml.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libsvml.so (0x00002aaaabaf7000)
        libirng.so => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libirng.so (0x00002aaaac9ca000)
        libintlc.so.5 => /opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/libintlc.so.5 (0x00002aaaacbd1000)

@ggouaillardet
Copy link
Contributor

iirc, the root cause is libopen-rte.so and libopen-pal.so do require the intel runtime
also, I am not sure ifort has a static version of the fortran runtime
and btw, we do not care here, what we really want is an orted not depending on the dynamic limbs of the intel runtime, right ?

@jsquyres
Copy link
Member

jsquyres commented Sep 2, 2015

@ggouaillardet Good point: if I ./configure LDFLAGS=-Wc,-static-intel, then libopen-pal and libopen-rte both get statically linked with the intel runtime (i.e., ldd .libs/lib*so | grep intel yields nothing). However, the orted still dynamically links against the intel runtime libs.

Soo.... I don't know where to go from here.

@ggouaillardet
Copy link
Contributor

@jsquyres i do not observe this behavior ...

here is some basic info about my system
configure command line is

'--enable-mpirun-prefix-by-default' '--enable-debug' '--enable-picky' 'LDFLAGS=-Wc,-static-intel' 'CC=icc' 'CXX=icpc' 'FC=ifort'

icc version

$ icc --version
icc (ICC) 15.0.2 20150121
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

make log

$ make V=1 orted
/bin/sh ../../../libtool  --tag=CC   --mode=link icc -std=gnu99  -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread  -Wc,-static-intel  -o orted orted.o ../../../orte/libopen-rte.la ../../../opal/libopen-pal.la -lrt -lutil   -lrt -lutil  
libtool: link: icc -std=gnu99 -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread -static-intel -o .libs/orted orted.o  ../../../orte/.libs/libopen-rte.so /home/RIST/gilles/build/ompi-master-intel-static-intel/opal/.libs/libopen-pal.so ../../../opal/.libs/libopen-pal.so -lm -ldl -lrt -lutil -pthread -Wl,-rpath -Wl,/home/RIST/gilles/local/ompi-master-intel-static-intel/lib
icc: warning #10237: -lcilkrts linked in dynamically, static library not available

note the warning about libcilkrts.so, which is really useless

and the ldd output

$ ldd .libs/orted 
    linux-vdso.so.1 =>  (0x00007fff345ff000)
    libopen-rte.so.0 => /home/RIST/gilles/local/ompi-master-intel-static-intel/lib/libopen-rte.so.0 (0x00007f2fd0ff9000)
    libopen-pal.so.0 => /home/RIST/gilles/local/ompi-master-intel-static-intel/lib/libopen-pal.so.0 (0x00007f2fd0bfc000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003c62400000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003c61800000)
    librt.so.1 => /lib64/librt.so.1 (0x0000003c62c00000)
    libutil.so.1 => /lib64/libutil.so.1 (0x0000003c71800000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003c65c00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003c62000000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003c61c00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003c61400000)

and here is my super verbose output

$ make LDFLAGS="-static-intel -#" V=1 orted
/bin/sh ../../../libtool  --tag=CC   --mode=link icc -std=gnu99  -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread  -static-intel -# -o orted orted.o ../../../orte/libopen-rte.la ../../../opal/libopen-pal.la -lrt -lutil   -lrt -lutil  
libtool: link: icc -std=gnu99 -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread -static-intel "-#" -o .libs/orted orted.o  ../../../orte/.libs/libopen-rte.so /home/RIST/gilles/build/ompi-master-intel-static-intel/opal/.libs/libopen-pal.so ../../../opal/.libs/libopen-pal.so -lm -ldl -lrt -lutil -pthread -Wl,-rpath -Wl,/home/RIST/gilles/local/ompi-master-intel-static-intel/lib
icc: warning #10237: -lcilkrts linked in dynamically, static library not available
/home/Apps/intel/composer_xe_2015.2.164/bin/intel64/mcpcom  \
    -mP1OPT_version=15.0-intel64 \
    -mGLOB_diag_file=orted.diag \
    -mP1OPT_print_version=FALSE \
    -mCG_use_gas_got_workaround=F \
    -mP2OPT_align_option_used=TRUE \
    -mGLOB_gcc_version=446 \
    "-mGLOB_options_string=-std=gnu99 -g -finline-functions -fno-strict-aliasing -restrict -Qoption,cpp,--extended_float_types -pthread -static-intel -# -o .libs/orted -lm -ldl -lrt -lutil -pthread -Wl,-rpath -Wl,/home/RIST/gilles/local/ompi-master-intel-static-intel/lib" \
    -mGLOB_cxx_limited_range=FALSE \
    -mCG_extend_parms=FALSE \
    -mGLOB_compiler_bin_directory=/home/Apps/intel/composer_xe_2015.2.164/bin/intel64 \
    -mP3OPT_emit_line_numbers \
    -mGLOB_debug_target=GLOB_DEBUG_TARGET_ALL \
    -mDEBUG_info_level=2 \
    -mDEBUG_use_indirect_strings=TRUE \
    -mGLOB_debug_format=GLOB_DEBUG_FORMAT_DWARF30 \
    -mGLOB_as_output_backup_file_name=/tmp/iccGn5bvras_.s \
    -mIPOPT_activate \
    -mGLOB_em64t \
    -mGLOB_product_id_code=0x22006d91 \
    -mP3OPT_use_mspp_call_convention \
    -mGLOB_ansi_alias=FALSE \
    -mIPOPT_ninl_user_level=2 \
    -mPGOPTI_value_profile_use=T \
    -mGLOB_opt_report_use_source_name \
    -mGLOB_opt_report_per_object_dir=.libs \
    -mP2OPT_il0_array_sections=TRUE \
    -mGLOB_offload_mode=1 \
    -mP2OPT_offload_unique_var_string=icc010898721520QAzGWl \
    -mP2OPT_hlo \
    -mP2OPT_restrict_in_function \
    -mP2OPT_hpo_rtt_control=0 \
    -mIPOPT_args_in_regs=0 \
    -mP2OPT_disam_assume_nonstd_intent_in=FALSE \
    -mGLOB_imf_mapping_library=/home/Apps/intel/composer_xe_2015.2.164/bin/intel64/libiml_attr.so \
    -mP2OPT_hlo_embed_loopinfo \
    -mPGOPTI_gen_threadsafe_level=0 \
    -mIPOPT_link \
    -mIPOPT_ipo_activate \
    -mIPOPT_mo_activate \
    -mIPOPT_source_files_list=/tmp/iccslisw0j8Hf \
    -mIPOPT_mo_global_data \
    -mIPOPT_link_script_file=/tmp/iccscriptWNCZiE \
    "-mIPOPT_cmdline_link="/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crt1.o" "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crti.o" "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/crtbegin.o" "--eh-frame-hdr" "--build-id" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-m" "elf_x86_64" "-o" ".libs/orted" "-L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64" "-L/opt/intel/composer_xe_2015.2.164/ipp/../compiler/lib/intel64" "-L/opt/intel/composer_xe_2015.2.164/ipp/lib/intel64" "-L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64" "-L/opt/intel/composer_xe_2015.2.164/mkl/lib/intel64" "-L/opt/intel/composer_xe_2015.2.164/tbb/lib/intel64/gcc4.4" "-L/home/Apps/intel/composer_xe_2015.2.164/compiler/lib/intel64" "-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/" "-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64" "-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/" "-L/lib/../lib64" "-L/lib/../lib64/" "-L/usr/lib/../lib64" "-L/usr/lib/../lib64/" "-L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/" "-L/opt/intel/composer_xe_2015.2.164/ipp/../compiler/lib/intel64/" "-L/opt/intel/composer_xe_2015.2.164/ipp/lib/intel64/" "-L/opt/intel/composer_xe_2015.2.164/mkl/lib/intel64/" "-L/opt/intel/composer_xe_2015.2.164/tbb/lib/intel64/gcc4.4/" "-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../" "-L/lib64" "-L/lib/" "-L/usr/lib64" "-L/usr/lib" "orted.o" "../../../orte/.libs/libopen-rte.so" "/home/RIST/gilles/build/ompi-master-intel-static-intel/opal/.libs/libopen-pal.so" "../../../opal/.libs/libopen-pal.so" "-L/home/Apps/intel/composer_xe_2015.2.164/compiler/lib/intel64" "-Bstatic" "-limf" "-Bdynamic" "-lm" "-ldl" "-lrt" "-lutil" "-rpath" "/home/RIST/gilles/local/ompi-master-intel-static-intel/lib" "-Bdynamic" "-Bstatic" "-limf" "-lsvml" "-lirng" "-Bdynamic" "-lm" "-Bstatic" "-lipgo" "-ldecimal" "--as-needed" "-Bdynamic" "-lcilkrts" "-lstdc++" "--no-as-needed" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc" "-Bdynamic" "-lpthread" "-Bstatic" "-lsvml" "-Bdynamic" "-lc" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc_s" "-Bdynamic" "-ldl" "-lc" "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/crtend.o" "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crtn.o"" \
    -mIPOPT_il_in_obj \
    -mIPOPT_ipo_activate_warn=FALSE \
    -mIPOPT_obj_output_file_name=/tmp/ipo_iccCcr78R.o \
    -mIPOPT_whole_archive_fixup_file_name=/tmp/iccwarchBxf3Tp \
    -mGLOB_linker_version=2.20.51.0.2 \
    -mGLOB_long_size_64 \
    -mGLOB_routine_pointer_size_64 \
    -mGLOB_driver_tempfile_name=/tmp/icctempfileWRcaAO \
    -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS \
    -mGLOB_async_unwind_tables=TRUE \
    -mGLOB_obj_output_file=/tmp/ipo_iccCcr78R.o \
    -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_NONE \
    -mP1OPT_source_file_name=ipo_out.c \
    orted.o \
    -mIPOPT_object_files=T \
    -mIPOPT_assembly_files=/tmp/iccalisgWyLkF \
    -mIPOPT_generated_tempfiles=/tmp/iccelisoj5AV3 \
    -mIPOPT_embedded_object_base_name=/tmp/icceobjHkirws \
    -mIPOPT_cmdline_link_new_name=/tmp/iccllisIwDh7Q

ld  \
    /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crt1.o \
    /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crti.o \
    /usr/lib/gcc/x86_64-redhat-linux/4.4.6/crtbegin.o \
    --eh-frame-hdr \
    --build-id \
    -dynamic-linker \
    /lib64/ld-linux-x86-64.so.2 \
    -m \
    elf_x86_64 \
    -o \
    .libs/orted \
    -L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64 \
    -L/opt/intel/composer_xe_2015.2.164/ipp/../compiler/lib/intel64 \
    -L/opt/intel/composer_xe_2015.2.164/ipp/lib/intel64 \
    -L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64 \
    -L/opt/intel/composer_xe_2015.2.164/mkl/lib/intel64 \
    -L/opt/intel/composer_xe_2015.2.164/tbb/lib/intel64/gcc4.4 \
    -L/home/Apps/intel/composer_xe_2015.2.164/compiler/lib/intel64 \
    -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/ \
    -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64 \
    -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/ \
    -L/lib/../lib64 \
    -L/lib/../lib64/ \
    -L/usr/lib/../lib64 \
    -L/usr/lib/../lib64/ \
    -L/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/ \
    -L/opt/intel/composer_xe_2015.2.164/ipp/../compiler/lib/intel64/ \
    -L/opt/intel/composer_xe_2015.2.164/ipp/lib/intel64/ \
    -L/opt/intel/composer_xe_2015.2.164/mkl/lib/intel64/ \
    -L/opt/intel/composer_xe_2015.2.164/tbb/lib/intel64/gcc4.4/ \
    -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../ \
    -L/lib64 \
    -L/lib/ \
    -L/usr/lib64 \
    -L/usr/lib \
    orted.o \
    ../../../orte/.libs/libopen-rte.so \
    /home/RIST/gilles/build/ompi-master-intel-static-intel/opal/.libs/libopen-pal.so \
    ../../../opal/.libs/libopen-pal.so \
    -L/home/Apps/intel/composer_xe_2015.2.164/compiler/lib/intel64 \
    -Bstatic \
    -limf \
    -Bdynamic \
    -lm \
    -ldl \
    -lrt \
    -lutil \
    -rpath \
    /home/RIST/gilles/local/ompi-master-intel-static-intel/lib \
    -Bdynamic \
    -Bstatic \
    -limf \
    -lsvml \
    -lirng \
    -Bdynamic \
    -lm \
    -Bstatic \
    -lipgo \
    -ldecimal \
    --as-needed \
    -Bdynamic \
    -lcilkrts \
    -lstdc++ \
    --no-as-needed \
    -lgcc \
    -lgcc_s \
    -Bstatic \
    -lirc \
    -Bdynamic \
    -lpthread \
    -Bstatic \
    -lsvml \
    -Bdynamic \
    -lc \
    -lgcc \
    -lgcc_s \
    -Bstatic \
    -lirc_s \
    -Bdynamic \
    -ldl \
    -lc \
    /usr/lib/gcc/x86_64-redhat-linux/4.4.6/crtend.o \
    /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crtn.o

rm /tmp/iccdummyIELLnK.c
rm /tmp/iccdashvTtJSO8
rm /tmp/icclibgccCpJzhx
rm /tmp/iccdummyLofMKV.c
rm /tmp/iccgccdashvUdD0dk
rm /tmp/iccgnudirseAOIII
rm /tmp/iccolispo9VJg
rm /tmp/iccalisgWyLkF
rm /tmp/iccelisoj5AV3
rm /tmp/iccllisIwDh7Q
rm /tmp/iccslisw0j8Hf
rm /tmp/iccscriptWNCZiE
rm /tmp/ipo_iccCcr78R.o
rm /tmp/iccgas0jkRT2
rm /tmp/iccGn5bvras_.s
rm /tmp/iccldashvfPyx6P
rm /tmp/iccgnudirsXFNlIe
rm /tmp/iccgnudirsR9RGkD
rm /tmp/iccgnudirsyIbAX1
rm /tmp/iccldashvDPR2Aq
rm /tmp/iccgnudirs7dIXeP
rm /tmp/iccldashv2CjsTd
rm /tmp/iccgnudirsRQ1pyC
rm /tmp/iccgnudirsXkgXd1
rm /tmp/icctempfileWRcaAO
rm /tmp/iccargvLykgd

did you configure with --disable-dlopen ?
does orted depend on other third party libs (such as libfabric.so) that depends on the dynamic libs of the intel runtime ?

i will give an other try with a more recent compiler

@ggouaillardet
Copy link
Contributor

i had no issue with icc 15.0.3 and 16.0.0
on top of that, -Wc-,static-intel is not even passed to the wrappers (!)

@anhzhang
Copy link

anhzhang commented Sep 7, 2015

I used the newest icc, there is no problem for statical linking, all orte* binaries are good, since orted depends on libopen-pal.so and libopen-rte.so, these two files needs to be statically linked with intel libs.

$ icc -v
icc version 16.0.0 (gcc version 4.4.7 compatibility)

$./configure CC=icc CXX=icpc FC=ifort LDFLAGS=-Wc,-static-intel

]$ ldd orte*
ortecc:
linux-vdso.so.1 => (0x00007fff1a7ff000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b9576e34000)
libm.so.6 => /lib64/libm.so.6 (0x00002b957716a000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b95773ee000)
librt.so.1 => /lib64/librt.so.1 (0x00002b95775f2000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b95777fb000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b95779fe000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b9577c14000)
libc.so.6 => /lib64/libc.so.6 (0x00002b9577e32000)
/lib64/ld-linux-x86-64.so.2 (0x00002b9576c12000)
orte-clean:
linux-vdso.so.1 => (0x00007fff19171000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002b8072453000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b80726e9000)
libm.so.6 => /lib64/libm.so.6 (0x00002b8072a1f000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b8072ca3000)
librt.so.1 => /lib64/librt.so.1 (0x00002b8072ea8000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b80730b0000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b80732b3000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b80734ca000)
libc.so.6 => /lib64/libc.so.6 (0x00002b80736e7000)
/lib64/ld-linux-x86-64.so.2 (0x00002b8072231000)
orted:
linux-vdso.so.1 => (0x00007fff26bff000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002b14f9a0b000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b14f9ca1000)
libm.so.6 => /lib64/libm.so.6 (0x00002b14f9fd7000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b14fa25b000)
librt.so.1 => /lib64/librt.so.1 (0x00002b14fa460000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b14fa668000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b14fa86b000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b14faa82000)
libc.so.6 => /lib64/libc.so.6 (0x00002b14fac9f000)
/lib64/ld-linux-x86-64.so.2 (0x00002b14f97e9000)
orte-info:
linux-vdso.so.1 => (0x00007fff0a7ff000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002b4f63f2d000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b4f641c3000)
libm.so.6 => /lib64/libm.so.6 (0x00002b4f644f9000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b4f6477d000)
librt.so.1 => /lib64/librt.so.1 (0x00002b4f64982000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b4f64b8a000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b4f64d8d000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b4f64fa4000)
libc.so.6 => /lib64/libc.so.6 (0x00002b4f651c1000)
/lib64/ld-linux-x86-64.so.2 (0x00002b4f63d0b000)
orte-ps:
linux-vdso.so.1 => (0x00007fff5770a000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002b81a9cdd000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b81a9f73000)
libm.so.6 => /lib64/libm.so.6 (0x00002b81aa2a9000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b81aa52d000)
librt.so.1 => /lib64/librt.so.1 (0x00002b81aa732000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b81aa93a000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b81aab3d000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b81aad54000)
libc.so.6 => /lib64/libc.so.6 (0x00002b81aaf71000)
/lib64/ld-linux-x86-64.so.2 (0x00002b81a9abb000)
orterun:
linux-vdso.so.1 => (0x00007fff5c5ff000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002b352a02f000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b352a2c5000)
libm.so.6 => /lib64/libm.so.6 (0x00002b352a5fb000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b352a87f000)
librt.so.1 => /lib64/librt.so.1 (0x00002b352aa84000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b352ac8c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b352ae8f000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b352b0a6000)
libc.so.6 => /lib64/libc.so.6 (0x00002b352b2c3000)
/lib64/ld-linux-x86-64.so.2 (0x00002b3529e0d000)
orte-server:
linux-vdso.so.1 => (0x00007fff419ff000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002aca446a0000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002aca44936000)
libm.so.6 => /lib64/libm.so.6 (0x00002aca44c6c000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002aca44ef0000)
librt.so.1 => /lib64/librt.so.1 (0x00002aca450f5000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002aca452fd000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002aca45500000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aca45717000)
libc.so.6 => /lib64/libc.so.6 (0x00002aca45934000)
/lib64/ld-linux-x86-64.so.2 (0x00002aca4447e000)
orte-top:
linux-vdso.so.1 => (0x00007fff6ad13000)
libopen-rte.so.7 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-rte.so.7 (0x00002b7ff56c1000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002b7ff5957000)
libm.so.6 => /lib64/libm.so.6 (0x00002b7ff5c8d000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b7ff5f11000)
librt.so.1 => /lib64/librt.so.1 (0x00002b7ff6116000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b7ff631e000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b7ff6521000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b7ff6738000)
libc.so.6 => /lib64/libc.so.6 (0x00002b7ff6955000)
/lib64/ld-linux-x86-64.so.2 (0x00002b7ff549f000)

$ ldd libopen-rte.so.7 libopen-pal.so.6
libopen-rte.so.7:
linux-vdso.so.1 => (0x00007fffd29cd000)
libopen-pal.so.6 => /pmpi2/anzhang/src/ompi.newest.icc/run/shared/lib/libopen-pal.so.6 (0x00002adfa868d000)
libm.so.6 => /lib64/libm.so.6 (0x00002adfa89c3000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002adfa8c47000)
librt.so.1 => /lib64/librt.so.1 (0x00002adfa8e4b000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002adfa9054000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002adfa9257000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002adfa946d000)
libc.so.6 => /lib64/libc.so.6 (0x00002adfa968b000)
/lib64/ld-linux-x86-64.so.2 (0x00002adfa81d3000)
libopen-pal.so.6:
linux-vdso.so.1 => (0x00007fffba591000)
libm.so.6 => /lib64/libm.so.6 (0x00002b4ff6f50000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b4ff71d4000)
librt.so.1 => /lib64/librt.so.1 (0x00002b4ff73d8000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b4ff75e1000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b4ff77e4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b4ff79fa000)
libc.so.6 => /lib64/libc.so.6 (0x00002b4ff7c18000)
/lib64/ld-linux-x86-64.so.2 (0x00002b4ff69f6000)

@anhzhang
Copy link

anhzhang commented Sep 7, 2015

One strange thing is the Intel option "-static-intel", according to https://software.intel.com/zh-cn/node/523256, it is a linker option, so we should specify it for make with "-Wl" if we want to do a dynamic building for orted, but actually it fails, we have to use "-Wc"

[orted]$ make LDFLAGS=-Wl,-static-intel
CC orted.o
CCLD orted
ipo: warning #11016: Warning unknown option -static-intel
ld: unrecognized -a option `tic-intel'

Only -Wc,-static-intel works fine:

[orted]$ make LDFLAGS=-Wc,-static-intel
CC orted.o
CCLD orted
icc: warning #10237: -lcilkrts linked in dynamically, static library not available

Anyway, let's use LDFLAGS=-Wc,-static-intel.

@ggouaillardet
Copy link
Contributor

my 0.02US$...
I did nto dig into this, but that could be a libtool bug.
-static-intel is definitely an icc option (e.g. not a ld one), and we use icc as a linker to build the shared libraries, that could explain why we need -Wc flag

@ggouaillardet
Copy link
Contributor

or that could be an icc bug/feature
libtool mode=link -Wc,-static-intel ...
invokes
icc -static-intel ...
whereas
libtool mode=link -Wl,-static-intel
invokes
icc -Wl,-static-intel ...
which invokes
ld -static-intel ...
which is not what we expected

I will double check that tomorrow, meanwhile feel free to ask icc folks what they think of that
(e.g. libtool vs icc bug, or just features and we really have to use -Wc,-static-intel in LDFLAGS even if this is counter intuitive)

@ggouaillardet
Copy link
Contributor

my guess was right

libtool --mode=link icc -Wc,-static-intel ...

does invoke

icc -static-intel ...

whereas

libtool --mode=link icc -Wl,-static-intel ...

does invoke

icc -Wl,-static-intel ...

which ends up invoking

ld -static-intel ...

as i stated earlier, i am not sure whether this is a bug or a feature, and if this is a bug, i cannot tell if it comes from libtool (e.g. do not pass -Wl,-static-intel but -static-intel to icc) or icc
(e.g. do not pass -static-intel to the linker but uses it in icc)

@jsquyres
Copy link
Member

jsquyres commented Sep 8, 2015

@ggouaillardet Per

Good point: if I ./configure LDFLAGS=-Wc,-static-intel, then libopen-pal and libopen-rte both get statically linked with the intel runtime (i.e., ldd .libs/lib*so | grep intel yields nothing). However, the orted still dynamically links against the intel runtime libs.

I just tested again on a clean tree. I don't know what happened with my prior test -- I must have had something stale left over.

Specifically: when I tested on a clean tree this morning, I got the expected result:

  • ./configure CC=icc CXX=icpc FC=ifort LDFLAGS=-Wc,-static-intel ...
  • ldd orted did not show any dynamic intel runtime libraries

So.

Where does this leave us? Since the initial suggested approach of "just link orted with -static-intel" doesn't work, which solution are we considering here:

  1. Add documentation in the README / FAQ about ./configure LDFLAGS=-Wc,-static-intel ....
  2. Add a --enable-static-runtime configure option that automatically adds -Wc,-static-intel to LDFLAGS when the intel compiler are being used

@gpaulsen
Copy link
Member Author

gpaulsen commented Sep 8, 2015

In general I'm for simplifying the configure time options, in favor of "doing as much at runtime as possible". Of course that's not an option in this case.

We might need to implement this for other Linux Comiler runtime environments as well. It's safe to assume (is it?) that the GNU compiler runtimes would be installed, but other compilers such as the IBM XL C/C++ runtime for Linux on Power (and others that I'm unfamiliar with) should be supported as well.

This feels like one of those options that might be a nightmare maintaining over time. Are many interested in this feature? I worry that it might expose other issues in loading both the compiler static runtime and the compiler dynamic runtime (possibly different versions) in the same process. I'd expect that this would "just work", but this option exposes any issues in this to Open MPI.

I'd vote for #1, but am curious about other's thoughts as well.

@jsquyres
Copy link
Member

jsquyres commented Sep 8, 2015

Yeah, having a --enable-static-runtime configure option allows us to hide the details based on whatever compiler was picked. That does make a bit more work for us, though (i.e., we need some kind of switch/case inside the configury to add the Right flags based on which compiler suite is being used).

FWIW:

  • The GNU compilers don't typically need us to do anything (I suppose you could have a problem if gcc is installed outside /usr/bin and the usual linker-search locations, but 99.99% of the world does not do that)
  • We've definitely seen people have this problem with the Intel compiler suite (...but only occasionally)
  • I assume that the other compiler suites can have this problem, too, but perhaps I don't really hearing about them on the user's mailing list. Perhaps they typically rpath/runpath properly, so that this isn't an issue...?

It might be sufficient to do option 1 (documentation in README/FAQ) and if it becomes a consistent problem, we can resurrect the idea of --enable-static-runtime. Thoughts?

@anhzhang
Copy link

anhzhang commented Sep 9, 2015

I think the option 1 is good, I have tested that the following steps are enough to resolve the old problem:

  1. ./configure --prefix=... CC=icc CXX=icpc FC=ifort ...
  2. cd opal; make LDFLAGS=-Wc,-static-intel
  3. cd orte; make LDFLAGS=-Wc,-static-intel
  4. back to top src dir; make all install

libopen-opal.so, libopen-rte.so and all orte binaries under bin will be linked to intel libs statically. Other files won't be touched.

And libmpi.so will be linked to intel libs dynamically, but this is ok, user can use"-x LD_LIBRARY_PATH=..." to set the right path dynamically for MPI applications.

@ggouaillardet
Copy link
Contributor

i agree only libopen-pal.so and libopen-rte.so should be statically linked with the intel runtime
(e.g. libmpi.so and its fortran/oshmem/pmix friends should use the dynamic intel runtime)

that being said, i am not sure it is quite right to override LDFLAGS on the command line.

on one hand, a --enable-static-runtime option will be hard to maintain on all compilers,
on the other hand, the current process (so libmpi.so is not statically with the intel runtime) is complicated and might not be quite right.

at this stage, i'd rather do something like

configure --with-opal-ldflags=-Wc,-static-intel --with-orte-ldflags=-Wc,-static-intel

or

configure --with-opal-extra-ldflags=-Wc,-static-intel --with-orte-extra-ldflags=-Wc,-static-intel

and document this in a FAQ

make sense ?

@jsquyres
Copy link
Member

jsquyres commented Sep 9, 2015

Why is it bad to pass LDFLAGS=-Wc,-static-intel on the configure command line (and have everything link the Intel runtime statically)?

@anhzhang
Copy link

@jsquyres I have no strong reason to say it is bad :), but only want to keep it within a narrow scope, it should be less risky. Actually, I like this way, otherwise I need some time to learn autotools :)

@jsquyres
Copy link
Member

Ok, cool. I go back to what I said in #818 (comment), then. :-)

@anhzhang
Copy link

@jsquyres I realized your idea is better than me after I did some works on the configure.ac, *.m4 and some Makefile.am.
Although I have got a rough solution and made it work as expected, I found if we want be accurate be what binaries should be statically linked to Intel libraries, the future maintenance work should be in some trouble, if we introduce new binary or so file, we need to be careful that if it needs to be statically linked to Intel libraries or not.

For example, I passed the "-Wc, -static-intel" to build libopen-opal.so, libopen-orte.so and orted successfully, but the testing showed that I also need pass it to mca_shmem_mmap.so, mca_shmem_posix and etc.

So to narrow down the scope is good theoretically, but consider the maintenance, passing "-Wc, -static-intel" to all is better.

Please give your comment :), thanks.

@jsquyres
Copy link
Member

I'm fine with either approach as described in #818 (comment) -- the documentation route is easier; the --enable-static-runtime route is a bit more automatic for users, and involves a little configury work for us (in this case, I think we should just use the same flags everywhere -- i.e., add them to LDFLAGS -- as opposed to only using the static runtime flags for some libraries/tools and not others).

@gpaulsen
Copy link
Member Author

An Huang? Aren't you updating the FAQ?

@anhzhang
Copy link

@gpaulsen Yes, I am learning the material about https://help.github.com/categories/collaborating and git, I need to be careful when I do this for the first time :)

@anhzhang
Copy link

@jsquyres For this problem, I think we only need to add something into http://www.open-mpi.org/faq/?category=mpi-apps, what is the process for it? Thanks.

@jsquyres
Copy link
Member

@jsquyres
Copy link
Member

@anhzhang Any progress on the FAQ?

@anhzhang
Copy link

@jsquyres Sorry for being quiet for a long time because we have a very long National Day Holiday :)
I have forked my ompi-www respository, created a new branch, modified the file faq\building.inc, and finally created one pull request for it : https://github.com/anhzhang/ompi-www/pull/1, I am not sure if this is the right process, please give your comments, thank you very much.

@jsquyres
Copy link
Member

@anhzhang Hope you had a good vacation! You're close -- make the pull requests against the open-mpi/ompi-www repo. Then we can comment on it, etc. from there.

anhzhang added a commit to anhzhang/ompi-www that referenced this issue Oct 14, 2015
@jsquyres
Copy link
Member

To close out this issue: we decided to make this an FAQ item and leave autogen/configure alone. The FAQ item has been added, so I'm closing this issue (and #829).

jsquyres pushed a commit to jsquyres/ompi that referenced this issue Aug 23, 2016
…logical.endpoint.rank

btl-portals4: set endpoint rank even if endpoint already exists
bwbarrett pushed a commit to open-mpi/ompi-www that referenced this issue Oct 7, 2018
bwbarrett pushed a commit to open-mpi/ompi-www that referenced this issue Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants