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

LInking Error Linux 32 bit

sicb0161
Beginner
698 Views
Hello,

I have the following system setup
- Linux Ubuntu 8.04 32 bit
- compiler gcc 4.1
- Intel MKL 10.0.2.018


------------------------------------------------------------------------
1. Question (static & dynamic linking):
My makefile looks like

MKL_PATH = /opt/intel/mkl/10.0.2.018
MKL_INC = $(MKL_PATH)/include
MKL_LIB = $(MKL_PATH)/lib/32

main : main.o
gcc main.o -L$(MKL_LIB) -lmkl_intel -lmkl_intel_thread -lmkl_core -lguide -lpthread -lm -o main

main.o: main.c
gcc -c main.c -I$(MKL_INC)


The main function looks like this:
#include
#include
#include
int main()
{
int i;
const int m = 10;
const int n = 10;
float data1[m*n];
float res[m*n];

int ipiv;
int info;

for(i = 0; i < m*n; i++)
data1 = 1;


printf("%f ", cblas_sasum(m*n, data1, 1));

sgetrf(&m,&n,data1,&m,ipiv,&info);

printf("Info %d ",info);
return 0;
}


I get the following error:

./main: error while loading shared libraries: libguide.so: cannot open shared object file: No such file or directory


If I change the make file to

main : main.o
gcc main.o -L$(MKL_LIB) $(MKL_LIB)/libmkl_intel.a $(MKL_LIB)/libmkl_intel_thread.a $(MKL_LIB)/libmkl_core.a $(MKL_LIB)/libguide.a -lpthread -lm -o main


it works. Why ?
-------------------------------------------------------------------------------------
2. Question :
If I add the sgeev command from the lapack library and invoke the makefile with the second (working) above mentioned configuration,

sgeev(&jobvl, &jobvr, &n, data1, &n, wr, wi, vl , &ldvr, vr, &ldvr, work, &lwork, &info);


I get the following error message:

/opt/intel/mkl/10.0.2.018/lib/32/libmkl_core.a(sgehrd.o): In function `mkl_lapack_sgehrd':
__tmp_sgehrd.f:(.text+0x787): undefined reference to `mkl_blas_strmm'
/opt/intel/mkl/10.0.2.018/lib/32/libmkl_core.a(slahr2.o): In function `mkl_lapack_slahr2':
__tmp_slahr2.f:(.text+0xd35): undefined reference to `mkl_blas_strmm'
__tmp_slahr2.f:(.text+0xe72): undefined reference to `mkl_blas_strmm'
/opt/intel/mkl/10.0.2.018/lib/32/libmkl_core.a(slaqr5.o): In function `mkl_lapack_slaqr5':
__tmp_slaqr5.f:(.text+0x1f20): undefined reference to `mkl_blas_strmm'
__tmp_slaqr5.f:(.text+0x2056): undefined reference to `mkl_blas_strmm'
/opt/intel/mkl/10.0.2.018/lib/32/libmkl_core.a(slaqr5.o):__tmp_slaqr5.f:(.text+0x2883): more undefined references to `mkl_blas_strmm' follow
collect2: ld returned 1 exit status
make: *** [main] Error 1


What needs to be done for a correct call of the main function.
0 Kudos
1 Reply
TimP
Honored Contributor III
698 Views
For the dynamic link, you may need to assure that LD_LIBRARY_PATH is set. For the static link, you must include -Wl,--begin-group .... --Wl, --end-group (or equivalent), in accordance with provided examples, or repeat the library list a sufficient number of times to resolve the circular dependencies. If the libraries are listed in order, 3 repetitions should be sufficient.
0 Kudos
Reply