OpenCV x86 missing a few hunderd DLL's

-1

I'm making an application in C++ where I need to use OpenCV x86. I use OpenCV 4.1.2, which I compiled and build my self by using CMake and visual studio 2019. During the configure/generation of the OpenCV files, I did not use the extra modules in opencv_contrib as this resulted in large amounts of errors during the build of OpenCV x86. When I run OpenCV x64 (did not need to build this my self) I do not get any errors, but I do need to make this application is x86.

I have added the include and lib path into the vs 2019 C++ solution, and I have added the OpenCV_world412d.lib file. When I build the application, I do not receive any errors, but when I run the application, I get the following error: The application was unable to start correctly (0xc000007b). I downloaded dependency walker, and to my surprise, I'm missing hundreds of DLLs according to dependency walker (500 different DLLs).

Of course, it's not feasible to show all the DLLs I'm missing here, but there are two big categories and a few lone DLLs that I'm missing. See the list below.

  • API-ms-win -*
  • DMENTERPRISEDIAGNOSTICS.DLL
  • EFSCORE.DLL
  • EMCLIENT.DLL
  • EXT-MS-*
  • IESHIMS.DLL
  • NGCRECOVERY.DLL
  • WFDSCONMGR.DLL
  • WPAXHOLDER.DLL

To see the full list of DLLs I'm missing, please find them here: GitHub Gist

This is the code that I use to test out OpenCV

#include <string>
#include <vector>
#include <opencv2/opencv.hpp>

using namespace cv;

int main()
{
    Mat image = Mat::zeros(300, 600, CV_8UC3);
    circle(image, Point(250, 150), 100, Scalar(0, 255, 128), -100);
    circle(image, Point(350, 150), 100, Scalar(255, 255, 255), -100);
    imshow("Display Window", image);
    waitKey(0);
    return 0;
}

Not sure if this is relevant to this issue. I'm using a Windows 10 64bit laptop to create the application and run dependency walker.

I hope I have given enough information about this issue, if not please say so.

c++
opencv
dll
asked on Stack Overflow Nov 27, 2019 by wes

1 Answer

0

Next to the lib directory, there should be a bin directory that contains the OpenCV DLLs. As already mentioned in the comments, the Dependency Walker build found on the official website does, unfortunately, not work correctly on Windows 10. The missing DLLs it reports are not going to be accurate.

There are multiple ways to get more info on an error 0xc000007b. First of all, the error should show up in the Windows event log as a System event where clicking on it should reveal some additional detail on what exactly failed to load. Apart from that, there is a flag you can set to turn on "loader snaps". The presence of this flag will make the Windows loader print debug output on what exactly is going on during the loading process. More on that here.

When you start your application, a process has to be created for it to run in. Creating a process requires that the Windows loader map your .exe as well as any DLLs it might need into the process' address space. DLLs are generally referred to in an .exe by name, not by full path. The Windows loader will follow a quite elaborate search process in order to locate the DLL that is to be used by your process. The bin directory next to your lib directory will not be one of the directories searched by the Windows loader unless specifically instructed to do so.

By default, the first directory in which the loader will look for a DLL is the directory that contains the binary that is currently being loaded. The loader also looks in the directories listed in the PATH environment variable. Two common ways to solve this problem are to either copy all the necessary DLLs into the directory where .exe file lives, or to add the directory that contains the DLLs to the PATH environment variable…

answered on Stack Overflow Nov 27, 2019 by Michael Kenzel • edited Nov 27, 2019 by Michael Kenzel

User contributions licensed under CC BY-SA 3.0