Facing The Problem To Linking With Static Library

Facing The Problem To Linking With Static Library

I am facing the problem to linking with static library.

I am getting the below error message.
exchange_data.c:(.text+0x374): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0x3e2): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0x4d3): undefined reference to `ompi_mpi_int'
exchange_data.c:(.text+0x5b7): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0x673): undefined reference to `ompi_mpi_comm_world'
exchange_data.c:(.text+0x680): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0x6cc): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0x718): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0x843): undefined reference to `ompi_mpi_int'
exchange_data.c:(.text+0xa62): undefined reference to `ompi_mpi_byte'
exchange_data.c:(.text+0xb54): undefined reference to `ompi_mpi_int'
exchange_data.c:(.text+0xb7c): undefined reference to `ompi_mpi_int

Above undefined symbol is matches with following STATIC library.


So, In the Make file I've add the flags in the following way.

LIBS      = -L$(HYPRE_DIR)/lib -lHYPRE  -L/app/intel/composer_xe_2013.1.117/mkl/lib/intel64/
LFLAGS    = $(LINKOPTS) $(LIBS) -lstdc++  -lmkl_blacs_openmpi_ilp6

After that also while make. I get the same error message.

Could you help me to resolve the problem to link with static library?

Thanks & Regards,
Vijay Kumar TP

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Using MKL link advisor: http://software.intel.com/sites/products/mkl/MKL_Link_Line_Advisor.html

you would expect to see a requirement to quote the full path for each required static library, and to use the start-group ... end-group directives for the group of 3 basic Intel MPI libraries including mkl_ilp64.

If you have continued difficulty after reading the docs, the MKL forum would be the place to ask.

Needless to say, in case you don't wish to deal with the complexity of static linking, there is a default of dynamic linking, and dynamic linking would be a useful first step to assure that you have specified the necessary libraries.

Thanks for your update Tim.

That symbol matches only with STATIC library that symbol does not matches with any DYNAMIC library.

Thanks & Regards,
Vijay Kumar TP

Hi Vijay,

Have you installed OpenMPI in your compile environment? The symbols of ompi_mpi_int are used in the libmkl_blacs_opempi_lp64 or ilp64.a. but not defined in MKL library.  They should be from OpenMPI.  So you may need to build your application with OpenMPI CC or link OpenMPI library manually.

 If you also need MKL library, then as Tim mentioned, you need to add the MKL libraries group in your link line.

for example, I build a small program recently with the Intel MPI. The command line as below.

/opt/intel/impi/4.1.0/intel64/bin/mpiicc -o test.out myTest.c -I/opt/intel/composer_xe_2013.3.163/mkl/include

/opt/intel/composer_xe_2013.3.163/mkl/lib/intel64/libmkl_scalapack_lp64.a -Wl,--start-group  /opt/intel/composer_xe_2013.3.163/mkl/lib/intel64/libmkl_intel_lp64.a /opt/intel/composer_xe_2013.3.163/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/composer_xe_2013.3.163/mkl/lib/intel64/libmkl_core.a /opt/intel/composer_xe_2013.3.163/mkl/lib/intel64/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group -lpthread -lm -openmp

Best Regards,


$ nm  libmkl_blacs_openmpi_lp64.a |grep ompi_mpi_byte
                 U ompi_mpi_byte

$nm  libmkl_blacs_openmpi_ilp64.a |grep ompi_mpi_byte
                 U ompi_mpi_byte

As Ying mentioned, you would specify the ompi library only when you are building and running with OpenMPI.  It won't work with other MPI implementations.


Make file parameter.
CC        = mpicc
F77       = mpif77
CXX       = mpic++
F90       = mpif90
HYPRE_DIR = /app/hypre280 (Compile with GCC LIBRARY)

compiled successfully only with openmpi compiler.


In that same case if I replace

CC        = mpicc
F77       = mpif77
CXX       = mpic++
F90       = mpif90

HYPRE_DIR = /app/hypre-2.9.0b/ (Compile with INTEL LIBRARY)

compiled successfully only with INTEL  compiler.


When I try to cross compile with (HYPRE - compile gcc ) and intelmpi  in that case only I am getting error message Still now that problem is not yet resolved.These analysis I am doing for Application tuning for better performance.

What you've shared message it is really helpful.

Thanks for your support TIM & YING

Thanks & Regards,
Vijay Kumar TP



With Intel MPI, unless you over-rule the way it installs, mpif77 and mpif90 are wrappers for gfortran, which will be incompatible with ifort.  The mkl_blacs libraries come in versions for several different MPIs.  You must not mix libraries for different MPI or between gfortran and ifort.

Leave a Comment

Please sign in to add a comment. Not a member? Join today