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

pkg-config doesn't see sdl2 on windows 10 #5481

Closed
rtentser opened this issue Feb 3, 2021 · 7 comments
Closed

pkg-config doesn't see sdl2 on windows 10 #5481

rtentser opened this issue Feb 3, 2021 · 7 comments

Comments

@rtentser
Copy link

rtentser commented Feb 3, 2021

General summary/comments (optional)

If i try to build a project with sdl2 dependency, stack complains about pkg-config.

stack build
sdl2     > configure
sdl2     > Configuring sdl2-2.5.3.0...
sdl2     > Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.3.exe: The pkg-config package 'sdl2'
sdl2     > version ==2.0.6 || >2.0.6 is required but it could not be found.
sdl2     >
Progress 1/2

--  While building package sdl2-2.5.3.0 (scroll up to its section to see the error) using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.3.exe --builddir=.stack-work\dist\274b403a configure --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\4bfdce68\pkgdb 
--libdir=C:\sr\snapshots\4bfdce68\lib --bindir=C:\sr\snapshots\4bfdce68\bin --datadir=C:\sr\snapshots\4bfdce68\share --libexecdir=C:\sr\snapshots\4bfdce68\libexec --sysconfdir=C:\sr\snapshots\4bfdce68\etc --docdir=C:\sr\snapshots\4bfdce68\doc\sdl2-2.5.3.0 --htmldir=C:\sr\snapshots\4bfdce68\doc\sdl2-2.5.3.0 --haddockdir=C:\sr\snapshots\4bfdce68\doc\sdl2-2.5.3.0 --dependency=StateVar=StateVar-1.2.1-7vo3tV8mPssJqOV48TU4OF --dependency=base=base-4.14.1.0 --dependency=bytestring=bytestring-0.10.12.0 --dependency=exceptions=exceptions-0.10.4 --dependency=linear=linear-1.21.4-IFgqQZPJc9xJpnZPhEC4kk --dependency=text=text-1.2.4.1 --dependency=transformers=transformers-0.5.6.2 --dependency=vector=vector-0.12.1.2-6jlbObSa8iuJfxUVGBQC5r -f-examples -f-no-linear -f-opengl-example --extra-include-dirs=C:\Users\rtentser\AppData\Local\Programs\stack\x86_64-windows\msys2-20200903\mingw64\include --extra-lib-dirs=C:\Users\rtentser\AppData\Local\Programs\stack\x86_64-windows\msys2-20200903\mingw64\lib --extra-lib-dirs=C:\Users\rtentser\AppData\Local\Programs\stack\x86_64-windows\msys2-20200903\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
    Process exited with code: ExitFailure 1

I can workaround it with stack exec -- env PKG_CONFIG_PATH="C:\Users\rtentser\AppData\Local\Programs\stack\x86_64-windows\msys2-20200903\mingw64\lib\pkgconfig" stack build (it brings other issues, but not related, i guess).

The problem is with pkg-config: it doesn't see sdl2 package.

Steps to reproduce

  1. stack exec -- pacman -S mingw-w64-x86_64-SDL2
  2. stack exec -- pkg-config --libs --cflags sdl2.

Expected

pkg-config should find sdl2.

Actual

stack exec -- pkg-config --libs --cflags sdl2
Package sdl2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'sdl2', required by 'virtual:world', not found

Stack version

stack --version
Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0

Method of installation

Chocolatey.

@rtentser rtentser changed the title pkg-config doen't see sdl2 on windows 10 pkg-config doesn't see sdl2 on windows 10 Feb 3, 2021
@New-York00
Copy link

Hi there!
Did you solve your problem?

@rtentser
Copy link
Author

No, not really.
But didn't try it for a while, so maybe something changed, i need to retest it.

@New-York00
Copy link

Could you try?

@Andrew-Clow
Copy link

Trying to build something using sdl2 on Windows 10, I get, after a lot of other things the error message below, and the workaround above doesn't work for me because there's nothing in my mingw64\lib folder. I can't find a pkg-config on stackage, and by the looks of it, that's a posix thing I don't have on Windows 10.

sdl2            > Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.4.exe: The program 'pkg-config' version
sdl2            > >=0.9.0 is required but it could not be found.
sdl2            >
Progress 1/4

--  While building package sdl2-2.5.3.0 (scroll up to its section to see the error) using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.4.exe --builddir=.stack-work\dist\274b403a configure --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\6c47b8e9\pkgdb --libdir
=C:\sr\snapshots\6c47b8e9\lib --bindir=C:\sr\snapshots\6c47b8e9\bin --datadir=C:\sr\snapshots\6c47b8e9\share --libexecdir=C:\sr\snapshots\6c47b8e9\libexec --sysconfdir=C:\sr\snapshots\6c47b8e9\etc --docdir=C:\sr\snapshots\6c47b8e9\do
c\sdl2-2.5.3.0 --htmldir=C:\sr\snapshots\6c47b8e9\doc\sdl2-2.5.3.0 --haddockdir=C:\sr\snapshots\6c47b8e9\doc\sdl2-2.5.3.0 --dependency=StateVar=StateVar-1.2.2-JzB38GfvdboHKyOpast2ii --dependency=base=base-4.14.1.0 --dependency=bytest
ring=bytestring-0.10.12.0 --dependency=exceptions=exceptions-0.10.4 --dependency=linear=linear-1.21.6-2H4CuXNxGZm8q5KlPYHn5g --dependency=text=text-1.2.4.1 --dependency=transformers=transformers-0.5.6.2 --dependency=vector=vector-0.1
2.3.0-Iq8W8y7X87B1xSQfAcXis3 -f-examples -f-no-linear -f-opengl-example --extra-include-dirs=C:\Users\AndrewC\AppData\Local\Programs\stack\x86_64-windows\msys2-20210604\mingw64\include --extra-lib-dirs=C:\Users\AndrewC\AppData\Local\Pr
ograms\stack\x86_64-windows\msys2-20210604\mingw64\lib --extra-lib-dirs=C:\Users\AndrewC\AppData\Local\Programs\stack\x86_64-windows\msys2-20210604\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
    Process exited with code: ExitFailure 1

@Andrew-Clow
Copy link

Andrew-Clow commented Aug 8, 2021

I followed the instructions here on reddit which got sdl2 installed, but then my project was stuck on SDL2_ttf, so I tried stack exec -- pacman -S mingw-w64-x86_64-SDL2_ttf with some success, because it compiled, but needed SDL2.dll and SDL2_ttf.dll. The first is available at https://www.libsdl.org/download-2.0.php and the second at https://www.libsdl.org/projects/SDL_ttf/

@SturdyPose
Copy link

This is weird because I remember half a year ago trying to find solution to the same issue as described here (didn't find this post then). I remember just downloading SDL2.dll or following reddit post metioned by @Andrew-Clow.

@mpilgrem
Copy link
Member

mpilgrem commented Mar 1, 2024

I am closing this issue given the passage of time and because I recently built something on Windows with a dependency on SDL2 without difficulty: see haskell-game/dear-imgui.hs#198.

@mpilgrem mpilgrem closed this as completed Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants