0

The application is developed with VC++2022 on Windows-11 using onnxruntime-win-x64-1.14.1. When the application is deployed on Windows Server 2012 R2, it runs with error:

api-ms-win-core-heap-l2-1-0.dll missing

enter image description here

Running dependency walker on Windows Server 2012 R2 shows: enter image description here

Here is another topic about this issue: error api-ms-win-core-heap-l2-1-0.dll is missing from your computer when saving pdf in Acrobat Reader RC

How to fix this problem?


Here is the VS settings: enter image description here enter image description here

user1633272
  • 2,007
  • 5
  • 25
  • 48
  • 1
    Have you installed the appropriate runtime for the exe that you built? When you built the exe, are you targeting the right OS version? – David Heffernan Mar 20 '23 at 11:38
  • this is *KernelBase.dll* , but on win7/8 probably this name unknown. you need build with another import lib simply. *dependency walker* - broken tool. it not show correct info. @DavidHeffernan - *api-ms-win-..* - this is not runtime but built in windows modules – RbMm Mar 20 '23 at 13:45
  • https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-apisets - you probably build with OneCore.lib when need use "classic" libs – RbMm Mar 20 '23 at 13:50
  • @RbMm the runtime calls the windows api – David Heffernan Mar 20 '23 at 16:58
  • @DavidHeffernan of course. but this problem can not be fixed by installing some runtime package. or runtime or application direct build to api set which not supported on this win8. so need use another runtime or another import lib – RbMm Mar 20 '23 at 17:01
  • 1
    @RbMm If the runtime for the exe that was built does not support the target OS, then the answer to my first question is no, and the second question is pertinent. The point is that the asker needs to work out what they are targeting. – David Heffernan Mar 20 '23 at 17:12
  • Link to kernel32.lib instead of mincore.lib or onecore.lib. – Hans Passant Mar 20 '23 at 21:20
  • @DavidHeffernan Where can I set the targeting OS in VS-2022? – user1633272 Mar 21 '23 at 03:34
  • @HansPassant I use default VS settings, in Linker/Command Line I can see it is using 'kernel32.lib' – user1633272 Mar 21 '23 at 03:39
  • 1
    "Windows SDK Version = 10.0 (latest installed version)" will default to programs that require whatever version Windows corresponds to the SDK you installed. If you want to run on Windows 8 / Server 2012, you need to set `NTDDI_VERSION` to `NTDDI_WIN8`. Ideally, you use a Windows 8 SDK instead of trying to get a Windows 8-compatible subset of a Windows 10 SDK. – Raymond Chen Mar 21 '23 at 03:52
  • @RaymondChen Where can I set `NTDDI_VERSION` to `NTDDI_WIN8` in VS2022? Ideally I want my app run on Server 2012 and Server 2019+. – user1633272 Mar 21 '23 at 04:32
  • 2
    `#define NTDDI_VERSION NTDDI_WIN8` anywhere before including `windows.h`. [Documentation](https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers?redirectedfrom=MSDN). – Raymond Chen Mar 21 '23 at 05:04
  • @RaymondChen Your above solution works. But onnxruntime.dll still depends on api-ms-win-core-heap-l2-1-0.dll, so I guess I have to build onnxruntime.dll from source. – user1633272 Mar 21 '23 at 14:30
  • BTW, I use `#define NTDDI_VERSION NTDDI_WINBLUE` instead of `#define NTDDI_VERSION NTDDI_WIN8` since Server 2012 is 8.1 based. – user1633272 Mar 21 '23 at 14:36

0 Answers0