Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.

libgcc independent binary

jinliang_w_
Beginner
871 Views

Hi there,

 

I want to generate binaries that are independent of libgcc. This can be done by the following compiling options,

 

ifort -O0 -fp-model source -ip -inline-factor=100 -unroll-aggressive x.f90 -static-libgcc

 

and the generated binary is indeed independent of libgcc, as checked by ldd.

 

HOWEVER, when I use the following compiling options to generate an MPI binary,

 

mpif90 -O0 -fp-model source -ip -inline-factor=100 -unroll-aggressive -openmp -openmp-link static x.f90  -static-intel -static-libgcc

 

The binary is dependent on libgcc, as checked by ldd.

 

Can anyone help, please?

0 Kudos
3 Replies
Heinrich_B_Intel
Employee
871 Views

 

Hi Jinliang,

It is normally not recommended to use Intel MPI with static linkage. I also see that you use mpif90 as MPI wrapper script. This wrapper uses gfortran internally! The correct wrapper script for ifort would be mpiifort. Please try if this solves your issue. 

best regards,
Heinrich

0 Kudos
jinliang_w_
Beginner
871 Views

Hi Heinrich,

Thank you very much for the comments and suggestions! However, when I replaced mpif90 by mpiifort, the binary has the following dependencies (as obtained by ldd)

        linux-vdso.so.1 =>  (0x00007fff113fe000)       

        libmpifort.so.12 => /shared/ucl/apps/intel/2015/impi/5.0.3.048/intel64/lib/libmpifort.so.12 (0x00007fa0b9d5c000)

        libmpi.so.12 => /shared/ucl/apps/intel/2015/impi/5.0.3.048/intel64/lib/libmpi.so.12 (0x00007fa0b95d1000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fa0b93bc000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fa0b91b3000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa0b8f97000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fa0b8c95000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fa0b88d3000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa0b9fe7000)
        libgcc_s.so.1 => /shared/ucl/apps/gcc/4.9.2/lib64/libgcc_s.so.1 (0x00007fa0b86bc000)

 

These are exactly the same as those of the binary produced with mpif90.

The reason I want to produce a statically linked MPI binary is that I just need to provide the users with the binary, no other dependency libaries.

Thanks!

0 Kudos
jinliang_w_
Beginner
871 Views

When I add the compiling option -static_mpi, the binary still has the following dependencies (although libgcc is no longer required).

        linux-vdso.so.1 =>  (0x00007fff76bfe000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fb222a99000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fb222891000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb222675000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fb222372000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fb221fb1000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb222cb0000)

0 Kudos
Reply