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

Unresolved Externals in RELEASE but not DEBUG version

Jim_Vickroy
Beginner
513 Views

Hello,

I can successfully compile/link/execute a Visual Fortran (XE 12.0.3.175 [IA-32]) DEBUG version of an application using the MKL under MS Visual Studio 2008. However, when attempting to build a RELEASE version of the application, link errors pertaining to the MKL occur. For example:

[bash]error LNK2019: unresolved external symbol _SGETRF@24 referenced in ...[/bash]
I have repeatedly checked to ensure the properties settings

[bash]Project > Properties > Configuration Properties > Linker > General > Additional Library Directories
Project > Properties > Configuration Properties > Linker > Input > Additional Dependencies.[/bash]
are identical for both DEBUG and RELEASE as per the Help information in

[bash]Configuring Intel Visual Fortran to Link with Intel MKL
[/bash]
I would appreciate guidance on how to locate/fix my mistakes.

Thanks,

-- jv

0 Kudos
1 Solution
mecej4
Honored Contributor III
513 Views
If a routine that calls MKL was compiled with /iface:CVF, you must use mkl_intel_s.lib rather than mkl_intel_c.lib to link your application. See if that is enough to build the application.

If you mix objects compiled with /iface:cvf and those compiled without that option, you have to be extra careful since /iface:cvf does not give you fine enough control. You may need to use !DEC$ directives.

View solution in original post

0 Kudos
4 Replies
mecej4
Honored Contributor III
513 Views
The unsatisfied external name, _SGETRF@24, indicates that the STDCALL convention was in effect when the routine containing the call to SGETRF was compiled. This convention is not the default for Intel Fortran and was chosen either by specifying the option in your project settings or as a command-line option, or using directives in your sources.

Please check your project settings, clean and rebuild. If you still get the same message, attach the build-log to your reply.

0 Kudos
Jim_Vickroy
Beginner
513 Views

Thanks for the helpful feedback. I now have a better understanding of the error.

My intention is to use the CVF call interface because of a dependency on an external library.

I am a novice user of the Visual Studio tool so I probably have made a mistake in its use regarding RELEASE and DEBUG builds. So far, I can not find the mistake.

As suggested, I have repeatedly performed a clean operation prior to a rebuild; the link error persists.

I have included the logs from the two stages of the RELEASE build; in Visual Studio parlance the Solution comprises a Library Project and an executable Project that uses the library. Note, this library is not the external dependency mentioned in the first paragraph above. Also note, the MKL dependencies are in my project library (not in the external dependency library).

Here is the build log for the library project:

[bash]Build Log 
 	 	 Build started: Project: SUVI Thematic Maps Lib, Configuration: Release|Win32 
 Output 
 	 	Compiling with Intel Visual Fortran Compiler XE 12.0.3.175 [IA-32]...
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filestesting.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /iface:cvf /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesarithmetic.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesglobals.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesutils.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesdate_time.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filescfitsio.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesfiles.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource fileslogging.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filescomposite_products.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesconfiguration.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filesprobability.f90"
ifort /nologo /I&quotC:Program FilesIntelComposerXE-2011mklinclude" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotReleasevc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /iface:cvf /Qvc9 /Qlocation,link,&quotc:Program FilesMicrosoft Visual Studio 9.0VC\bin" &quotC:Documents and Settingsjim.vickroyMy DocumentsVisual Studio 2008ProjectsSUVI Thematic MapsSUVI Thematic Maps Libsource filestheme_products.f90"
Creating library...
Lib /OUT:&quotRelease/SUVI Thematic Maps Lib.lib" /NOLOGO &quotReleasetesting.obj" &quotReleasearithmetic.obj" &quotReleaseglobals.obj" &quotReleaseutils.obj" &quotReleasedate_time.obj" &quotReleasecfitsio.obj" &quotReleasefiles.obj" &quotReleaselogging.obj" &quotReleasecomposite_products.obj" &quotReleaseconfiguration.obj" &quotReleaseprobability.obj" &quotReleasetheme_products.obj"
xilib: executing 'lib'


SUVI Thematic Maps Lib - 0 error(s), 0 warning(s)



[/bash]

Here is the build log for the executable project:

Build Log
Build started: Project: SUVI Thematic Maps Demo, Configuration: Release|Win32
Output
Compiling with Intel Visual Fortran Compiler XE 12.0.3.175 [IA-32]...
ifort /nologo /I&quotC:\Documents and Settings\jim.vickroy\My Documents\Visual Studio 2008\Projects\SUVI Thematic Maps\SUVI Thematic Maps Lib\Release" /iface:cvf /module:&quotRelease\" /object:&quotRelease\" /Fd&quotRelease\vc90.pdb" /libs:static /threads /c /libs:dll cfitsio.lib /MD /fpp /extfpp:cfortran.h,fitsio.h /Qvc9 /Qlocation,link,&quotc:\Program Files\Microsoft Visual Studio 9.0\VC\\bin" &quotC:\Documents and Settings\jim.vickroy\My Documents\Visual Studio 2008\Projects\SUVI Thematic Maps\SUVI Thematic Maps Demo\source files\demo.f90"
Linking...
Link /OUT:&quotRelease\SUVI Thematic Maps Demo.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:&quotC:\Documents and Settings\jim.vickroy\My Documents\Libraries" /LIBPATH:&quotC:\Program Files\Intel\ComposerXE-2011\mkl\lib\ia32" /MANIFEST /MANIFESTFILE:&quotC:\Documents and Settings\jim.vickroy\My Documents\Visual Studio 2008\Projects\SUVI Thematic Maps\SUVI Thematic Maps Demo\Release\SUVI Thematic Maps Demo.exe.intermediate.manifest" /MANIFESTUAC:&quotlevel='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:&quotC:\Documents and Settings\jim.vickroy\My Documents\Visual Studio 2008\Projects\SUVI Thematic Maps\SUVI Thematic Maps Demo\Release\SUVI Thematic Maps Demo.lib" cfitsio.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib &quotRelease\demo.obj" &quotC:\Documents and Settings\jim.vickroy\My Documents\Visual Studio 2008\Projects\SUVI Thematic Maps\SUVI Thematic Maps Lib\Release\SUVI Thematic Maps Lib.lib"
Link: executing 'link'
SUVI Thematic Maps Lib.lib(probability.obj) : error LNK2019: unresolved external symbol _SGETRF@24 referenced in function _COVARIANCE_MATRIX_COMPONENT_mp_COVARIANCE_MATRIX_INVERT
SUVI Thematic Maps Lib.lib(probability.obj) : error LNK2019: unresolved external symbol _SGETRI@28 referenced in function _COVARIANCE_MATRIX_COMPONENT_mp_COVARIANCE_MATRIX_INVERT
Release\SUVI Thematic Maps Demo.exe : fatal error LNK1120: 2 unresolved externals


SUVI Thematic Maps Demo - 3 error(s), 0 warning(s)

0 Kudos
mecej4
Honored Contributor III
514 Views
If a routine that calls MKL was compiled with /iface:CVF, you must use mkl_intel_s.lib rather than mkl_intel_c.lib to link your application. See if that is enough to build the application.

If you mix objects compiled with /iface:cvf and those compiled without that option, you have to be extra careful since /iface:cvf does not give you fine enough control. You may need to use !DEC$ directives.
0 Kudos
Jim_Vickroy
Beginner
513 Views

Wow ! Thanks ! I really appreciate your quick response and willingness to wade through the build logs.

Using mk_intel_s.lib (in place of mkl_intel_c.lib) resulted in successful compilation, linking, and execution.

I don't know if I would have ever resolved this.

It was (un)fortunate the DEBUG version worked with mkl_intel_c.lib.

0 Kudos
Reply