The following setup guide is produced by chatgpt, I will try it and verify it, modifying the parts that are not correct.
This is a from-zero → working demo → shipping build checklist for getting raylib + Haskell (h-raylib) running on Windows, and packaging your game so users can run it by double-clicking.
Core idea:
h-raylibtypically vendors the raylib C sources via the package build, so you usually do not need a separate raylib installation. What you do need is a working Haskell toolchain + a working Windows C toolchain.
Your shipped game will look like:
MyGame/
MyGame.exe
*.dll
assets/
LICENSES/
If you forget required *.dll files, users will get:
...dll was not found”The most common one for h-raylib builds on Windows is:
libwinpthread-1.dllOpen PowerShell (non-admin) and run:
Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol =
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
try {
& ([ScriptBlock]::Create(
(Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing)
)) -Interactive -DisableCurl
} catch { Write-Error $_ }During the interactive installer, enable:
Close the terminal, open a new PowerShell, verify:
ghc --version
cabal --versionh-raylib compiles C sources on Windows, so you need a working C compiler toolchain.
GHCup typically installs MSYS2 under something like:
C:\ghcup\msys64\
Use one of these:
C:\ghcup\msys64\msys2_shell.cmd -clang64C:\ghcup\msys64\msys2_shell.cmd -mingw64Recommended if you’re unsure:
C:\ghcup\msys64\msys2_shell.cmd -clang64Inside MSYS2 shell:
pacman -SyuIf MSYS2 tells you to close the shell, do it, reopen, then run again:
pacman -SyuThen install a toolchain:
-clang64pacman -S --needed base-devel mingw-w64-clang-x86_64-toolchain-mingw64pacman -S --needed base-devel mingw-w64-x86_64-toolchainh-raylib project (build + run)In PowerShell:
mkdir hello-raylib
cd hello-raylib
cabal init -n --is-executable --main-is Main.hs --language GHC2021Edit hello-raylib.cabal and add:
build-depends: base, h-raylib
Create Main.hs:
module Main where
import Raylib.Core
( beginDrawing, clearBackground, closeWindow, endDrawing
, initWindow, setTargetFPS
)
import Raylib.Core.Text (drawText)
import Raylib.Util (whileWindowOpen0)
import Raylib.Util.Colors (rayWhite, lightGray)
main :: IO ()
main = do
initWindow 800 450 "hello h-raylib on Windows"
setTargetFPS 60
whileWindowOpen0 $ do
beginDrawing
clearBackground rayWhite
drawText "Hello from h-raylib!" 220 200 24 lightGray
endDrawing
closeWindowcabal runThis is usually because:
Use the pattern:
whileWindowOpen0 + beginDrawing ... endDrawing in the looplibwinpthread-1.dll was not foundThis is very common.
Add one of these to PATH:
C:\ghcup\msys64\mingw64\binC:\ghcup\msys64\clang64\binPut libwinpthread-1.dll in the same folder as MyGame.exe.
Missing (or bad) C libraries: gcc_ehThis can happen from toolchain mismatch.
Usually fixed by:
clang64 vs mingw64)pacman (see Part B)Goal: a fresh Windows machine can run your game with no extra installs.
cabal buildFind the built exe path:
cabal list-bin exe:hello-raylibCopy to a release/ folder:
mkdir release
copy (cabal list-bin exe:hello-raylib) release\hello-raylib.exeRule of thumb:
✅ Put all required *.dll in the same folder as the .exe.
This avoids PATH problems for users.
Pick one method:
Use a Windows tool like Dependencies to open the exe and see what DLLs are needed.
From MSYS2:
objdump -p /path/to/hello-raylib.exe | grep "DLL Name"Common ones:
libwinpthread-1.dll ✅ very commonlibgcc_s_seh-1.dll (or similar)libstdc++-6.dlllibgmp-10.dll (often required by GHC builds)libffi-*.dll (sometimes)Usually from:
C:\ghcup\msys64\mingw64\bin\C:\ghcup\msys64\clang64\bin\Copy these DLLs into your release/ folder beside the exe.
Put assets under:
release/assets/...
Load assets relative to the exe directory so it works when double-clicked.
Example:
import System.Environment (getExecutablePath)
import System.FilePath (takeDirectory, (</>))
assetsDir :: IO FilePath
assetsDir = do
exe <- getExecutablePath
pure (takeDirectory exe </> "assets")Create:
release/LICENSES/
Add license texts for:
Ship release/ as a .zip.
User:
MyGame.exeUse an installer maker (Inno Setup / NSIS) to:
Before publishing:
✅ Test on a fresh Windows environment:
If it fails, it’s almost always:
Copy missing DLLs into release/ and re-test.
cabal buildrelease/.exe to release/*.dll into release/assets/✅ cabal run works on your dev machine
✅ release/MyGame.exe exists
✅ release/*.dll includes everything the exe needs
✅ release/assets/ loads correctly when double-clicked
✅ Tested on a fresh machine / sandbox
✅ Packaged as zip or installer