Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Facing The Problem To Linking With Static Library

Ramagounder_t_
Beginner
2,724 Views

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.

/app/intel/composer_xe_2013.1.117/mkl/lib/intel64/libmkl_blacs_openmpi_ilp64.a.

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
 

0 Kudos
7 Replies
TimP
Honored Contributor III
2,724 Views

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.

0 Kudos
Ramagounder_t_
Beginner
2,724 Views

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
 

0 Kudos
Ying_H_Intel
Employee
2,724 Views

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,

Ying

$ 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

0 Kudos
TimP
Honored Contributor III
2,724 Views

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.

0 Kudos
Ramagounder_t_
Beginner
2,724 Views

CASE 1

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.

CASE 2

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

 

 

0 Kudos
TimP
Honored Contributor III
2,724 Views

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.

0 Kudos
Rathod__Tejal
Beginner
2,724 Views

Hello Everyone,

                     I am facing same error. I tried all the above solution but still got this error .

main.o: In function `main':
/home/ipr/source-gravity/main.c:62: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:63: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:134: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:135: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:135: undefined reference to `ompi_mpi_op_sum'
/home/ipr/source-gravity/main.c:135: undefined reference to `ompi_mpi_double'
/home/ipr/source-gravity/main.c:136: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:136: undefined reference to `ompi_mpi_op_sum'
/home/ipr/source-gravity/main.c:136: undefined reference to `ompi_mpi_double'
/home/ipr/source-gravity/main.c:137: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:137: undefined reference to `ompi_mpi_op_sum'
/home/ipr/source-gravity/main.c:137: undefined reference to `ompi_mpi_double'
/home/ipr/source-gravity/main.c:138: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:138: undefined reference to `ompi_mpi_op_sum'
/home/ipr/source-gravity/main.c:138: undefined reference to `ompi_mpi_double'
/home/ipr/source-gravity/main.c:139: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:139: undefined reference to `ompi_mpi_op_sum'
/home/ipr/source-gravity/main.c:139: undefined reference to `ompi_mpi_double'
/home/ipr/source-gravity/main.c:176: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:176: undefined reference to `ompi_mpi_dblprec'
/home/ipr/source-gravity/main.c:177: undefined reference to `ompi_mpi_comm_world'
/home/ipr/source-gravity/main.c:177: undefined reference to `ompi_mpi_dblprec'
Makefile:21: recipe for target 'main' failed
make: *** [main] Error 1

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

CC    = mpiicc -O3 -g -Wall
INCLUDE = -I/opt/intel/parallel_studio_xe_2018/compilers_and_libraries_2018/linux/mpi/intel64/include -I/home/ipr/softwares/include
LIBS     = -L/home/ipr/softwares/lib -L/opt/intel/parallel_studio_xe_2018/compilers_and_libraries_2018/linux/mpi/intel64/lib
LFLAG    = -lm -lgsl -lgslcblas   

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

Could you help me to resolve the problem?

Thanks & Regards,

Tejal Rathod.

0 Kudos
Reply