Skip to content

Commit 69622e7

Browse files
committed
Add a note about the build errors with old libsdl2
1 parent 5cd891d commit 69622e7

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,45 @@ On Windows you can install SDL with `pacman` under [MSYS2](https://msys2.github.
4242
> ghc-options: -optl-mconsole
4343
> ```
4444
45+
## Build errors
46+
47+
If you are getting build errors like `‘SDL_Vertex’ undeclared` then your installed libsdl2 version is missing some recent additions.
48+
49+
You have two options to mitigate this:
50+
1. Flip a package flag named `recent-ish` in your **project** configuration file.
51+
* `cabal.project.local`:
52+
```yaml
53+
package sdl2
54+
flags: -recent-ish
55+
```
56+
* `stack.yaml`:
57+
```yaml
58+
flags:
59+
sdl2:
60+
recent-ish: false
61+
```
62+
2. Build SDL2 from source and use `extra-include-dirs` / `extra-lib-dirs` options, while disabling the pkgconfig-provided dependency:
63+
* `cabal.project.local`:
64+
```yaml
65+
extra-include-dirs: /path/to/sdl2/include
66+
extra-lib-dirs: /path/to/sdl2/lib
67+
package sdl2:
68+
flags: -pkgconfig
69+
```
70+
* `stack.yaml`:
71+
```yaml
72+
extra-include-dirs:
73+
- /path/to/sdl2/include
74+
extra-lib-dirs:
75+
- /path/to/sdl2/lib
76+
flags:
77+
sdl2:
78+
pkgconfig: false
79+
```
80+
81+
The flag enables some features from SDL2 past 2.0.8 and assumes a host system has at least version 2.0.20 installed.
82+
If you have libsdl2 version older than that, but need some features past 2.0.8, you'd have to use the `extra-*-dirs` way.
83+
4584
# Get Started
4685
4786
Take a look at the [getting started guide](https://hackage.haskell.org/package/sdl2/docs/SDL.html).

0 commit comments

Comments
 (0)