Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Deploying a Fortran Console Application

acar
Beginner
625 Views

I have written a small console application in Fortran which calls gelss routine.  The application runs in DEBUG configuration.  I then copied the various include and link information to a RELEASE configuration.  The command line options for Fortran and Linker tabs are shown below:

/nologo /debug:full /Od /I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.3.210\windows\mkl\include\ia32" /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc140.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /Qmkl:parallel /c

/nologo /O2 /I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.3.210\windows\mkl\include\ia32" /module:"Release\\" /object:"Release\\" /Fd"Release\vc140.pdb" /libs:dll /threads /c

/OUT:"Debug\Console1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" /MANIFEST /MANIFESTFILE:"Debug\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\RMA\Technical_Notes\Distributing a Point Load\DPL\Console1\Debug\Console1.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\RMA\Technical_Notes\Distributing a Point Load\DPL\Console1\Debug\Console1.lib"  mkl_lapack95.lib mkl_core.lib mkl_sequential.lib mkl_intel_thread.lib

/OUT:"Release\Console1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" /MANIFEST /MANIFESTFILE:"Release\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\RMA\Technical_Notes\Distributing a Point Load\DPL\Console1\Release\Console1.lib"  mkl_lapack95.lib mkl_core.lib mkl_sequential.lib mkl_intel_thread.lib

The application runs in DEBUG but in RELEASE gives the following issues:

Linking... Link /OUT:"Release\Console1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" /MANIFEST /MANIFESTFILE:"Release\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\RMA\Technical_Notes\Distributing a Point Load\DPL\Console1\Release\Console1.lib" mkl_lapack95.lib mkl_core.lib mkl_sequential.lib mkl_intel_thread.lib -qm32 "Release\DPL.obj" mkl_lapack95.lib(dgelss.obj) : error LNK2019: unresolved external symbol _DGELSS referenced in function _DGELSS_F95 mkl_lapack95.lib(dgelss.obj) : error LNK2019: unresolved external symbol _XERBLA referenced in function _DGELSS_F95 Release\Console1.exe : fatal error LNK1120: 2 unresolved externals

Can anyone please point me to my error?

0 Kudos
5 Replies
mecej4
Honored Contributor III
625 Views

The commands that you showed are somewhat mangled, but I suspect that the problem is that the order of specifying the libraries is incorrect.

Linkers scan libraries for unsatisfied externals. Since you specified the three MKL libraries before the OBJ file, there were no unsatisfied externals at that time. Move the names of the three MKL libraries to a position after mkl_lapack95.lib in the linker command, and try again.

0 Kudos
acar
Beginner
625 Views

Okay.  I've tried that (see below) but the problem remains?

 

/OUT:"Release\Console1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\ia32_win" /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" /MANIFEST /MANIFESTFILE:"Release\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\RMA\Technical_Notes\Distributing a Point Load\DPL\Console1\Release\Console1.lib"   mkl_core.lib mkl_sequential.lib mkl_intel_thread.lib mkl_lapack95.lib

0 Kudos
acar
Beginner
625 Views

Ah, I've changed the switch in the Fortran properties to use the MKL libraries:

/nologo /O2 /I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.3.210\windows\mkl\include\ia32" /module:"Release\\" /object:"Release\\" /Fd"Release\vc140.pdb" /libs:static /threads /Qmkl:parallel /c

It now compiles and links...

0 Kudos
mecej4
Honored Contributor III
625 Views

The part "mkl_core.lib mkl_sequential.lib mkl_intel_thread.lib mkl_lapack95.lib" is wrong. The last item, i.e., mkl_lapack95.lib, must come before the the others.

Instead of trying arbitrary changes, please consult the MKL Link Line Advisor at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor .

0 Kudos
acar
Beginner
625 Views

Ah, well it was before the other mkl libraries in my original version.  Either way it does not appear to work.  

If I use the Link Line Advisor then it suggests the following:

 mkl_lapack95.lib mkl_intel_c.lib mkl_sequential.lib mkl_core.lib

Which seems curious since I have not linked  mkl_intel_c.lib yet it still runs.

 

0 Kudos
Reply