Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dll not found problem #8370

Closed
igagis opened this issue Apr 14, 2021 · 7 comments
Closed

dll not found problem #8370

igagis opened this issue Apr 14, 2021 · 7 comments

Comments

@igagis
Copy link

igagis commented Apr 14, 2021

Hi,

I have a strange problem of a DLL being not found. I'm posting the issue here as I don't have any ideas of what else I can try to fix it.

I have an open source library project svgdom which I build for windows in msys2 environment.
I have github actions based CI configured in the github repo. The CI process first builds the library, producing the DLL, then it builds and runs test applications. To run a test application I have to copy the library DLL to the same directory as the test app's executable to make the test app load and link to the dll when it is run.

One can see the failed CI run here: for mingw64 and for mingw32

The strange thing is that it fails in the CI build, but on my local machine all passes successfully.

From the build log we can see that all test apps worked successfully except the one called tst.

The error when trying to run the tst app is as follows:
For mingw64:

D:/a/svgdom/svgdom/tests/tst/out/rel/tests.exe: error while loading shared libraries: libsvgdom.dll: cannot open shared object file: No such file or directory

For mingw32:

D:/a/svgdom/svgdom/tests/tst/out/rel/tests.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

The libsvgdom.dll file is there right next to tests.exe, that is 100% sure. I have checked that explicitly listing the dir contents on CI machine.

The only difference of the tst application from other test apps (which pass) I can think of is that the main() function in the tst app is provided by another DLL (libtst), not by the main executable. But again, all works fine on my local machine. And, similar tests are working fine for the libtst itself.

And I'll repeat again, the build (and those tests of course) passes successfully on my local machine in msys2 environment.

Any idea of what else can I try?

Thanks in advance!

@Biswa96
Copy link
Member

Biswa96 commented Apr 14, 2021

The strange thing is that it fails in the CI build, but on my local machine all passes successfully.

Maybe the same package is installed in your local setup.

@igagis
Copy link
Author

igagis commented Apr 14, 2021

@Biswa96 you are actually right! I had the same package installed on my local system. How could I overlook that...? I have just removed it.

But the strange thing remains, it still passes successfully on my local machine...

@igagis
Copy link
Author

igagis commented Apr 15, 2021

It looks like the environment configuration is somehow different on the CI machine... but what could be the difference potentially causing the issue?

Any hints on how can I debug the problem?

In the github actions CI I use the https://github.com/msys2/setup-msys2 action to configure the msys2 environment...

@igagis
Copy link
Author

igagis commented Apr 19, 2021

I figured out that a third level dependency DLL was missing, not the libsvgdom.dll itself. Now I've got it fixed.
Too bad that in msys2 it does not give information about which DLL file is actually missing.

@igagis igagis closed this as completed Apr 19, 2021
@Biswa96
Copy link
Member

Biswa96 commented Apr 19, 2021

Too bad that in msys2 it does not give information about which DLL file is actually missing.

There is a package ntldd which can provide the dependent DLLs of a EXE or DLL file.

@ZachBacon
Copy link
Contributor

I figured out that a third level dependency DLL was missing, not the libsvgdom.dll itself. Now I've got it fixed.
Too bad that in msys2 it does not give information about which DLL file is actually missing.

Funny enough... Ntldd which is a package, which helps track down dll deps are linked to. So say if you have a basic hello.exe which doesn't link to anything, it'll print out the compiler runtime deps libgcc dll (whatever unwinder is used) and libwinpthreads etc, so it's possible, but you'd have to check every file to make sure dependencies were met for your executable.

@igagis
Copy link
Author

igagis commented Apr 19, 2021

Well, it is good that there is at least some tool which allows inspecting dependencies.

But, from error message:

D:/a/svgdom/svgdom/tests/tst/out/rel/tests.exe: error while loading shared libraries: libsvgdom.dll: cannot open shared object file: No such file or directory

I can only understand that libsvgdom.dll is missing, but in reality it misses some other DLL it depends on. I.e. the error message is misleading too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants