Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Windows System Error can't find libwinpthread-1.dll #66

Open
creikey opened this issue Jan 12, 2022 · 12 comments
Open

Windows System Error can't find libwinpthread-1.dll #66

creikey opened this issue Jan 12, 2022 · 12 comments
Labels
help wanted Extra attention is needed windows Related to Windows OS windows11

Comments

@creikey
Copy link

creikey commented Jan 12, 2022

After following the readme and doing

nimble install nimraylib_now

Then trying to run a nim file with just

import nimraylib_now

in it
With

nim c -r -d:release --gc:orc crown.nim

I get this error:
image

@greenfork
Copy link
Owner

Hi, I think you can take a look at Troubleshooting section of readme https://github.com/greenfork/nimraylib_now#windows-error-the-application-was-unable-to-start-correctly-0x00000007b

@milanbt
Copy link

milanbt commented Feb 5, 2022

I'm having this problem too. Even after adding C:\Program Files\nim-1.6.2\dist\mingw64\bin to path, I still get "Windows error: The application was unable to start correctly (0x00000007b)" on other windows machines, although it ran on the one with mingw installed. I tried installing and setting path for mingw installed via msys with the same result. I'm on Windows 11.

@creikey
Copy link
Author

creikey commented Feb 5, 2022

Why does raylib need pthreads?

@creikey
Copy link
Author

creikey commented Feb 5, 2022

image

Maybe statically link like this?

@milanbt
Copy link

milanbt commented Feb 5, 2022

So I tried with
nim c -r -d:release --gc:orc --app:gui --passC:"-static" main.nim
It still didn't work, but now there is no error message when the dll is in the same folder and the same missing message without it.

@milanbt
Copy link

milanbt commented Feb 6, 2022

I tried compiling on a Windows 10 machine where I installed using choosenim. I think on the 11 I installed the binary on the nim website (it's installed in Program Files). Now it runs when I have libwinpthread-1.dll in the same directory on another Windows 10 computer and also the Windows 11 computer after removing libwinpthread-1.dll from the mingw\bin directory so it can't use that one.

Also, adding mingw\bin to the system path, rebooting, recompiling with --passC:"-static" --passL:"-lpthread", and running again on a different Windows 10 machine did not allow me to run without the libwinpthread-1.dll in the directory.

@greenfork
Copy link
Owner

Also, adding mingw\bin to the system path, rebooting, recompiling with --passC:"-static" --passL:"-lpthread", and running again on a different Windows 10 machine did not allow me to run without the libwinpthread-1.dll in the directory.

This is still connected to the wrong paths since the problem is not with the library but with Windows being unable to properly locate it. It is a hard sign that something is wrong with the paths.

Even after adding C:\Program Files\nim-1.6.2\dist\mingw64\bin to path

This successfully resolved the problem for this issue #2. I'm not sure what's wrong in your case.

Why does raylib need pthreads?

Raylib requires pthreads for some functionality. So linking is enabled by default for NimraylibNow. Disabling it by default won't solve the problem because once you need it, you will be in the same situation.

Overall, if you can find a recipe of what we need to change to make it work out of the box, we can add it to the library. But that being said, my understanding is that a lot of people use this library on Windows and they don't have these problems or they successfully solve them.

I will leave this issue open for some time so people can help. I think that we need to add some instruction on how to properly add the PATH to Windows to make it work. Or just to plainly copy the .dll since you will still have to distribute this game. Or maybe we can add some link step which will correctly detect the location of this .dll and link it on any Windows machine.

@greenfork greenfork reopened this Feb 6, 2022
@greenfork greenfork added question Further information is requested windows Related to Windows OS labels Feb 6, 2022
@milanbt
Copy link

milanbt commented Feb 6, 2022

I think it might be specific to compiling on Windows 11, since it worked when I compiled on Windows 10 (albeit only with the .dll in the directory)

@creikey
Copy link
Author

creikey commented Feb 6, 2022

My issues were with Windows 11 as well

@greenfork greenfork added help wanted Extra attention is needed and removed question Further information is requested labels Feb 7, 2022
@greenfork
Copy link
Owner

So far this is the best option: bundle libwinpthread-1.dll together with the exe which is located in C:\Program Files\nim-1.6.2\dist\mingw64\bin for default installation of Nim v1.6.2.

Now it runs when I have libwinpthread-1.dll in the same directory on another Windows 10 computer and also the Windows 11 computer after removing libwinpthread-1.dll from the mingw\bin directory so it can't use that one.

@enthus1ast
Copy link
Collaborator

It would be interesting to know where the library is searched. Can you check with strace? (In the git for windows installation or some tool mentioned here: https://stackoverflow.com/questions/3847745/systrace-for-windows ) then it would be much easier to track down the issue.

@greenfork
Copy link
Owner

@creikey @milanbt there's a possible solution in the PR, do you have time to check if that works for you?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed windows Related to Windows OS windows11
Projects
None yet
Development

No branches or pull requests

4 participants