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

first time user ---makefile linking problems

ronald_haynes
Beginner
875 Views
Hi everyone, I have installed mkl 8.0.1. I have the intel fortran compiler installed (and working). I have included both the makefile and partial output below.

The environment variable MKLPATH is set in the shell.

Any help would be greatly appreciated.

Thanks,
R Haynes


Here is the makefile:
drive: driver.o odesolve.o mynewton_nor.o xfdjac.o xfdjac1.o
ifort -o drive ${MKLPATH}/libmkl_lapack.a ${MKLPATH}/libmkl_solver.a
${MKLPATH}/libguide.a -lpthread driver.o odesolve.o mynewton_nor.o
xfdjac.o xfdjac1.o
driver.o: driver.f
ifort -c driver.f

odesolve.o: odesolve.f
ifort -c odesolve.f

mynewton_nor.o: mynewton_nor.f
ifort -c mynewton_nor.f

xfdjac.o: xfdjac.f
ifort -c xfdjac.f

xfdjac1.o: xfdjac1.f
ifort -c xfdjac1.f



Here is the output:

ifort -o drive /opt/intel/mkl/8.0.1/lib/32/libmkl_lapack.a /opt/intel/mkl/8.0.1/lib/32/libmkl_solver.a
/opt/intel/mkl/8.0.1/lib/32/libguide.a -lpthread driver.o odesolve.o mynewton_nor.o
xfdjac.o xfdjac1.o
IPO Error: unresolved : dgbtrf_
Referenced in odesolve.o
IPO Error: unresolved : dgbtrs_
Referenced in mynewton_nor.o
/opt/intel/mkl/8.0.1/lib/32/libmkl_lapack.a(_dgbtrf.o): In function `dgbtrf_':
_dgbtrf_iface.c:(.text+0x4c): undefined reference to `mkl_cfg_file'
_dgbtrf_iface.c:(.text+0x53): undefined reference to `cfg_serial'
_dgbtrf_iface.c:(.text+0x65): undefined reference to `MKL_SET_PARALLEL'
_dgbtrf_iface.c:(.text+0x96): undefined reference to `MKL_SET_SERIAL'
_dgbtrf_iface.c:(.text+0x9c): undefined reference to `cfg_serial'
/opt/intel/mkl/8.0.1/lib/32/libmkl_lapack.a(dgbtrf_omp.o): In function `mkl_lapack_dgbtrf':
ker_dgbtrf_omp.f:(.text+0x12b): undefined reference to `xerbla_'
ker_dgbtrf_omp.f:(.text+0x173): undefined reference to `mkl_serv_in_serial'
ker_dgbtrf_omp.f:(.text+0x68b): undefined reference to `idamax'
ker_dgbtrf_omp.f:(.text+0x7cc): undefined reference to `dswap'
ker_dgbtrf_omp.f:(.text+0x883): undefined reference to `dswap'
ker_dgbtrf_omp.f:(.text+0x90f): undefined reference to `dswap'
ker_dgbtrf_omp.f:(.text+0x991): undefined reference to `dscal'
ker_dgbtrf_omp.f:(.text+0xa5f): undefined reference to `dger'
ker_dgbtrf_omp.f:(.text+0xb2a): undefined reference to `dcopy'
ker_dgbtrf_omp.f:(.text+0xf81): undefined reference to `dgemm'
ker_dgbtrf_omp.f:(.text+0x107c): undefined reference to `dgemm'
ker_dgbtrf_omp.f:(.text+0x1397): undefined reference to `dgemm'
ker_dgbtrf_omp.f:(.text+0x146b): undefined reference to `dgemm'
ker_dgbtrf_omp.f:(.text+0x1738): undefined reference to `dswap'
ker_dgbtrf_omp.f:(.text+0x17d4): undefined reference to `dswap'
ker_dgbtrf_omp.f:(.text+0x187c): undefined reference to `dcopy'
0 Kudos
5 Replies
TimP
Honored Contributor III
875 Views
You must arrange so that the library searches occur after your .o files are loaded. Usually, this is done in something like the following fashion:
ifort -L/opt/intel/mkl/8.0.1/lib/32/ -openmp *.o -lmkl_lapack -lmkl_solver
0 Kudos
ronald_haynes
Beginner
875 Views
Hi, thanks for the swift reponse. So I changed the makefile to:

drive: driver.o odesolve.o mynewton_nor.o xfdjac.o xfdjac1.o
ifort -L/opt/intel/mkl/8.0.1/lib/32/
driver.o odesolve.o mynewton_nor.o xfdjac.o xfdjac1.o
-lmkl_lapack -lmkl_solver -o drive

(everything else unchanged)
and make now gives the output below--- any thoughts?
-------------------
output
-----------------
$make

ifort -o drive -L/opt/intel/mkl/8.0.1/lib/32/
driver.o odesolve.o mynewton_nor.o xfdjac.o xfdjac1.o
-lmkl_lapack -lmkl_solver
IPO Error: unresolved : mkl_cfg_file
Referenced in libmkl_lapack.a(_dgbtrf.o)
Referenced in libmkl_lapack.a(_dgbtrs.o)
IPO Error: unresolved : cfg_serial
Referenced in libmkl_lapack.a(_dgbtrf.o)
Referenced in libmkl_lapack.a(_dgbtrs.o)
IPO Error: unresolved : MKL_SET_PARALLEL
Referenced in libmkl_lapack.a(_dgbtrf.o)
Referenced in libmkl_lapack.a(_dgbtrs.o)
IPO Error: unresolved : MKL_SET_SERIAL
Referenced in libmkl_lapack.a(_dgbtrf.o)
Referenced in libmkl_lapack.a(_dgbtrs.o)
IPO Error: unresolved : __kmpc_global_thread_num
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : xerbla_
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(dgbtrs.o)
Referenced in libmkl_lapack.a(dgbtf2.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : mkl_serv_in_serial
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : omp_get_max_threads
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : __kmpc_ok_to_fork
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : __kmpc_fork_call
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : __kmpc_serialized_parallel
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : __kmpc_end_serialized_parallel
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : idamax
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(dgbtf2.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : dswap
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(dgbtrs.o)
Referenced in libmkl_lapack.a(dlaswp.o)
Referenced in libmkl_lapack.a(dgbtf2.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : dscal
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(dgbtf2.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : dger
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(dgbtrs.o)
Referenced in libmkl_lapack.a(dgbtf2.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : dcopy
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : dgemm
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : __kmpc_for_static_init_4
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : dtrsm
Refe renced in libmkl_lapack.a(dgbtrf_omp.o)
Referenced in libmkl_lapack.a(xdgbtrf.o)
IPO Error: unresolved : __kmpc_for_static_fini
Referenced in libmkl_lapack.a(dgbtrf_omp.o)
IPO Error: unresolved : mkl_serv_lsame
Referenced in libmkl_lapack.a(dgbtrs.o)
IPO Error: unresolved : dtbsv
Referenced in libmkl_lapack.a(dgbtrs.o)
IPO Error: unresolved : dgemv
Referenced in libmkl_lapack.a(dgbtrs.o)
/opt/intel/mkl/8.0.1/lib/32//libmkl_lapack.a(_dgbtrf.o): In function `dgbtrf_':
_dgbtrf_iface.c:(.text+0x4c): undefined reference to `mkl_cfg_file'
_dgbtrf_iface.c:(.text+0x53): undefined reference to `cfg_serial'
_dgbtrf_iface.c:(.text+0x65): undefined reference to `MKL_SET_PARALLEL'
_dgbtrf_iface.c:(.text+0x96): undefined reference to `MKL_SET_SERIAL'
_dgbtrf_iface.c:(.text+0x9c): undefined reference to `cfg_serial'
/opt/intel/mkl/8.0.1/lib/32//libmkl_lapack.a(dgbtrf_omp.o): In function `mkl_lapack_dgbtrf':
ker_dgbtrf_omp.f:(.text+0x6f): undefined reference to `__kmpc_global_thread_num'
ker_dgbtrf_omp.f:(.text+0x12b): undefined reference to `xerbla_'
ker_dgbtrf_omp.f:(.text+0x173): undefined reference to `mkl_serv_in_serial'
ker_dgbtrf_omp.f:(.text+0x18c): undefined reference to `omp_get_max_threads'
ker_dgbtrf_omp.f:(.text+0x223): undefined reference to `__kmpc_ok_to_fork'
ker_dgbtrf_omp.f:(.text+0x253): undefined reference to `__kmpc_fork_call'
ker_dgbtrf_omp.f:(.text+0x26f): undefined reference to `__kmpc_serialized_parallel'
0 Kudos
TimP
Honored Contributor III
875 Views
You didn't specify -lguide or -lpthread, which would be taken care of by -openmp or -parallel options to ifort. It looks like only mkl_lapack was searched successfully, as you are missing a bunch of references which the other mkl library should take care of. I haven't used 32-bit 8.0.1 myself.
0 Kudos
TimP
Honored Contributor III
875 Views
After some discussion with members of the compiler team, a concensus was reached that you were correct in not using the -L and -l method for linking MKL. However, you should link the libguide provided with the compiler, not the one provided with MKL, unless you are using an old compiler version, where the libguide is older than the one provided with MKL.



ifort -o drive -i-static -openmp

driver.o odesolve.o mynewton_nor.o

xfdjac.o xfdjac1.o

${MKLPATH}/libmkl_lapack.a ${MKLPATH}/libmkl_solver.a



The -i-static option specifies linking against the libguide.a and other static libraries provided with the compiler. The function of -openmp at link time is to add -lguide -lpthread.

Message Edited by tim18 on 03-05-2006 08:47 AM

0 Kudos
Andrey_G_Intel2
Employee
875 Views
mkl_lapack depends from main MKL library (libmkl_ia32.a/libmkl.so). You should include libmkl_ia32.a (or libmkl.so) into your link line after including mkl_lapack library.
0 Kudos
Reply