Visitar URL original
Does not seem to work under Windows · Issue #14 · Anut-py/h-raylib · GitHub
Skip to content

Does not seem to work under Windows #14

Closed

Description

@bjornkihlberg

Hello,

When I run the following program with cabal run under Windows nothing happens.

hello-raylib> cabal run
hello-raylib>

hello-raylib.cabal

cabal-version:      3.4
name:               hello-raylib
version:            0.1.0.0

common warnings
    ghc-options: -Wall

executable hello-raylib
    import:             warnings
    main-is:            Main.hs
    build-depends:      base ^>=4.16.0.0
                      , h-raylib
    hs-source-dirs:     app
    default-language:   Haskell2010

app/Main.hs

module Main where

import Control.Monad (unless)
import qualified Raylib.Core as Raylib

main :: IO ()
main = do
  w <- Raylib.initWindow 480 320 "Hello, Raylib!"
  let loop = do
        shouldClose <- Raylib.windowShouldClose
        unless shouldClose loop
  loop
  Raylib.closeWindow w

I tried updating my NVidia drivers. No change.
I installed raylib and successfully ran one of their examples in C so I suspect there's something wrong with this package or something I've done or missed in the code posted above.

Thank you and kind regards
Björn

Activity

  1. bjornkihlberg commented on Mar 25, 2023

    @bjornkihlberg
    Author

    I tried running hello-raylib.exe inside dist-newstyle/build/x86_64-windows/ghc-9.2.1/hello-raylib-0.1.0.0/x/hello-raylib/\build/hello-raylib/ directly and I got this.
    image
    So it says (writing this for poor souls using a search engine)

    The code execution cannot proceed because libwinpthread-1.dll was not found. Reinstalling the program may fix this problem.
    

    which is a clue.

  2. bjornkihlberg commented on Mar 25, 2023

    @bjornkihlberg
    Author

    I got it to work with this solution.

    The issue is that libwinpthread-1.dll is not available on the PATH when trying to run your raylib application. It looks like Windows users using Nim had the same problem.

    Here are the steps I did explicitly:

    1. I use ghcup which keeps msys2 in its installation folder so I added C:\ghcup\msys64 to my PATH which allows me to open the msys2 executable. I don't think this is strictly needed but I did it so I'm writing it down here.
    2. I also added C:\ghcup\msys64\mingw64\bin which is actually needed for raylib to work.
    3. Then I ran msys2 and in it's shell ran this command
      $ pacman -Syu
      
      which updates the current libraries. After it's done it wants to shut down the shell. Accept and start it up again.
    4. Then I ran these commands
      $ pacman -S msys2-keyring
      $ pacman -Syu
      $ pacman -S base-devel mingw-w64-x86_64-toolchain
      
      I had issues with some PGP signatures so I had to install msys2-keyring and then run another system update to make them work. Note that I didn't need to restart the shell this time!
    5. I exited out of the shell and cabal run worked.

    My program behaved funny but it wasn't the fault of raylib. It was because I didn't invoke beginDrawing and endDrawing which I assume polls the window for events.

    Anyway, I though I'd leave this here in case anyone else runs into this.

  3. Anut-py commented on Mar 25, 2023

    @Anut-py
    Owner

    Great, I'm glad you could find a solution! I'll add a link to this in the readme.

  4. added
    bugSomething isn't working
    windowsProblems with the bindings on windows
    on Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwindowsProblems with the bindings on windows

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions