Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Problem compiling code using MKL with "ifort"

greg_sheard
Beginner
728 Views

Hi all,

I am attempting to port a fortran code from Windows to a Linux Itanium2 processor-based system, and am receiving "undefined reference to" errors during linking for all the functions I call from the Intel MKL (the Linux version is installed, btw). I previously was using Lahey Fortran under Windows, but must use Intel Fortran on the linux system, and they treat mixed-language function passing a little differently.

To get started I am trying to get the MKL example source code "ddotx.f" to compile, using the following:

ifort -L/opt/intel-mkl/7.2.1.003/mkl721/lib/64 -lmkl_solver -lmkl_lapack -lmkl_ipf -lguide -lpthread ddotx.f

The error messages are as follows:

/tmp/ifortRKlaVH.o(.text+0x642): In function `MAIN__':
: undefined reference to `printvectord_'
/tmp/ifortRKlaVH.o(.text+0x672): In function `MAIN__':
: undefined reference to `printvectord_'
/tmp/ifortRKlaVH.o(.text+0x6a2): In function `MAIN__':
: undefined reference to `ddot_'

The snippet of code where the "ddot" function is mentioned is:

* External Subroutines
external DDOT, PrintVectorD
double precision DDOT

I have tried several varieties of upper and lower case in relation to the DDOT function, and have attempted to use !DEC$ ALIAS commands and trailing underscores to rectify this issue, but I have had no luck. If anyone knows the solution to this problem it would be of great assistance.

Regards,

Greg.

0 Kudos
1 Reply
TimP
Honored Contributor III
728 Views
What's the question? ddot_ is the expected symbol name; you could use nm to check its presence in the static library. Did you actually choose to install mkl in the directory you quote in the -L path? If so, correcting the order of your link command should take care of it. gnu ld uses libraries in the order specified. References made after the libraries are searched will be left undefined.
0 Kudos
Reply