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

strange .dll not found problem #126

Closed
igagis opened this issue Apr 19, 2021 · 4 comments
Closed

strange .dll not found problem #126

igagis opened this issue Apr 19, 2021 · 4 comments
Labels
question Further information is requested

Comments

@igagis
Copy link

igagis commented Apr 19, 2021

Hi,

I'm using msys2/setup-msys2 action to set up msys2 shell on my CI build. Recently I started having a strange problem when one of the test apps which tests the library being built on the CI is unable to load the library .dll.

I asked about what could be the possible problem here: msys2/MINGW-packages#8370
But it looks like they have no idea.

Since the problem only occurs on the CI machine (locally all works fine), I thought that there might be some difference in how the environment is configured by the msys2/setup-msys2 action, so, posting the problem here.

Here goes the copy of the problem description from the link above.

===================================================

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!

@eine
Copy link
Collaborator

eine commented Apr 19, 2021

My guess is that the issue is not related to libsvgdom.dll being not found. Instead, you need some other DLL, or libsvgdom depends on some other DLL which is missing. So, libsvgdom.dll: cannot open shared object file: No such file or directory does not mean it cannot find that specific file, but it found some error while trying to do so. Can you try it locally in a clean environment? You can extract the tarballs from https://github.com/msys2/msys2-installer/releases/tag/nightly-x86_64, in order to preserve your current installation untouched.

@igagis
Copy link
Author

igagis commented Apr 19, 2021

Thanks! You were right! There was a third-level dependency DLL missing. I've got it working now. Thanks for the idea!

@igagis igagis closed this as completed Apr 19, 2021
@eine
Copy link
Collaborator

eine commented Apr 20, 2021

I'm glad it worked! I've been hit by that several times... Unfortunately, I'm not sure what's the underlying issue. I.e. which is the tool under the hood responsible for generating a better error message .

@eine eine added the question Further information is requested label Apr 20, 2021
@lazka
Copy link
Member

lazka commented Apr 20, 2021

I think the code responsible is here: https://github.com/msys2/msys2-runtime/blob/0eee28b4ad46bcf4ed60d6bb612dc1e477b639b1/winsup/cygwin/pinfo.cc#L115

In particular find_first_notloaded_dll() seems to not give good results in many cases..

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

No branches or pull requests

3 participants