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

NMAKE unresolved external symbols

Mikhail_K_
Beginner
1,452 Views

Hi,

I'm playing around with the custom dll builder tool (windows\mkl\tools\builder) to make a stdcall BLAS dll for Win32.

I'm using blas_stdcall_example_list provided in the same directory, with the following command:

nmake libia32 export=blas_stdcall_example_list interface=stdcall name=mkl_blas_stdcall

Should I be doing anything differently?




C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\mkl\tools\builder>nmake libia32 export=blas_stdcall_example_list interface=stdcall name=mkl_blas_stdcall

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        set Lib=..\..\lib\ia32;%Lib%;..\..\..\compiler\lib\ia32
        type "blas_stdcall_example_list" | findstr /V "^[;#]" >> user_def_file.def
Microsoft (R) Library Manager Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Library Manager Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        link /DLL /MANIFEST /MACHINE:IX86 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libmmt.lib /NODEFAULTLIB:libirc.lib /NODEFAULTLIB:svml_dispmt.lib /NODEFAULTLIB:libdecimal.lib /def:user_def_file.def  .\temp_cdll\i_malloc_dll.obj .\temp_cdll\_vml_dll_core.obj   mkl_intel_s.lib mkl_intel_thread.lib mkl_core.lib  libiomp5md.lib  msvcrt.lib kernel32.lib user32.lib /out:"mkl_blas_stdcall".dll
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library mkl_blas_stdcall.lib and object mkl_blas_stdcall.exp
_vml_dll_core.obj : error LNK2019: unresolved external symbol _MKL_Thread_Free_Buffers referenced in function _DllMain@12
_vml_dll_core.obj : error LNK2019: unresolved external symbol _MKL_Finalize referenced in function _DllMain@12
mkl_blas_stdcall.dll : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.

 

0 Kudos
1 Solution
Zhen_Z_Intel
Employee
1,452 Views

Dear customer,

I wonder did you changed the link line in makefile? The root cause is lack of mkl_intel_c.lib. I checked with your link line, seems you only link with mkl_intel_s but no mkl_intel_c. You could modify the makefile like before:

IFACE_LIB_32=mkl_intel_c.lib
IFACE_LIB_32_DLL=mkl_intel_c_dll.lib

!if "$(interface)"=="std" || "$(interface)"=="stdcall" || "$(interface)"=="STD" || "$(interface)"=="STDCALL"
IFACE_LIB_32=$(IFACE_LIB_32) mkl_intel_s.lib
IFACE_LIB_32_DLL=$(IFACE_LIB_32_DLL) mkl_intel_s_dll.lib
!endif
....

Like above, the  default interface layer lib is mkl_intel_c.lib, while you specify the interface as stdcall, both mkl_intel_c & mkl_intel_s will be used to link.

Best regards,
Fiona

View solution in original post

0 Kudos
3 Replies
Zhen_Z_Intel
Employee
1,453 Views

Dear customer,

I wonder did you changed the link line in makefile? The root cause is lack of mkl_intel_c.lib. I checked with your link line, seems you only link with mkl_intel_s but no mkl_intel_c. You could modify the makefile like before:

IFACE_LIB_32=mkl_intel_c.lib
IFACE_LIB_32_DLL=mkl_intel_c_dll.lib

!if "$(interface)"=="std" || "$(interface)"=="stdcall" || "$(interface)"=="STD" || "$(interface)"=="STDCALL"
IFACE_LIB_32=$(IFACE_LIB_32) mkl_intel_s.lib
IFACE_LIB_32_DLL=$(IFACE_LIB_32_DLL) mkl_intel_s_dll.lib
!endif
....

Like above, the  default interface layer lib is mkl_intel_c.lib, while you specify the interface as stdcall, both mkl_intel_c & mkl_intel_s will be used to link.

Best regards,
Fiona

0 Kudos
Mikhail_K_
Beginner
1,452 Views

Hi,

It worked! Thank you so much.

But, no, I used the original makefile as is. The code (which I now have commented out and used yours instead) is exactly this:

 

IFACE_LIB_32=mkl_intel_c.lib
IFACE_LIB_32_DLL=mkl_intel_c_dll.lib

!if "$(interface)"=="std" || "$(interface)"=="stdcall" || "$(interface)"=="STD" || "$(interface)"=="STDCALL"
IFACE_LIB_32=mkl_intel_s.lib
IFACE_LIB_32_DLL=mkl_intel_s_dll.lib
!endif

 

 

0 Kudos
Zhen_Z_Intel
Employee
1,452 Views

Dear Mikhail,

Oh, indeed. IFACE_LIB_32 has been replaced only link to mkl_intel_s. I think you are using MKL 2017 gold. This problem has been fixed since 2017 update 1. Thanks. 

Best regards,
Fiona

0 Kudos
Reply