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

Cabal won't install Monomer because of Nanovg #258

Closed
liamzee opened this issue Feb 16, 2023 · 16 comments
Closed

Cabal won't install Monomer because of Nanovg #258

liamzee opened this issue Feb 16, 2023 · 16 comments
Labels
build issues Build is failing platform issue Issue happening on specific platform

Comments

@liamzee
Copy link

liamzee commented Feb 16, 2023

PS C:\Users\Liam> cabal install monomer
Resolving dependencies...
Error: cabal-3.8.1.0.exe: Could not resolve dependencies:
[__0] next goal: monomer (user goal)
[__0] rejecting: monomer-1.5.1.0 (conflict: pkg-config package glew-any, not
found in the pkg-config database)
[__0] trying: monomer-1.5.0.0
[__1] trying: nanovg-0.8.1.0 (dependency of monomer)
[__2] rejecting: nanovg:-stb_truetype (conflict: pkg-config package
freetype2-any, not found in the pkg-config database)
[__2] rejecting: nanovg:+stb_truetype (manual flag can only be changed
explicitly)
[__2] fail (backjumping, conflict set: nanovg, nanovg:stb_truetype)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: nanovg, monomer, nanovg:stb_truetype

Cabal 3.8.1.0 obviously, Windows 10, GHC 9.4.4.

@fjvallarino
Copy link
Owner

Hi @liamzee!

I don't currently have a Windows box to test, but it seems you're missing a dependency. There are a few OS libraries you need to install before building Monomer. Here are the steps for Windows.

In particular, you seem to be missing Freetype, based on this part of the logs:

[__2] rejecting: nanovg:-stb_truetype (conflict: pkg-config package
freetype2-any, not found in the pkg-config database)

@fjvallarino fjvallarino added the question Further information is requested label Feb 16, 2023
@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

I'm using Cabal over Stack, and I've installed the stuff via mingw.

Right now, the point of failure is SDL2:

Starting sdl2-2.5.4.0 (lib)
Building sdl2-2.5.4.0 (lib)

Failed to build sdl2-2.5.4.0.
Build log (
C:\cabal\logs\ghc-9.4.4\sdl2-2.5.4.0-6f358c10fe4537617bb1a1c0ecc08f28deb40fdf.log
):
Preprocessing library for sdl2-2.5.4.0..
linking dist\build\SDL\Raw\Enum_hsc_make.o failed (exit code 1)
rsp file was: "dist\build\SDL\Raw\hsc986A.rsp"
command was: C:\ghcup\ghc\9.4.4\lib../mingw/bin\clang.exe dist\build\SDL\Raw\Enum_hsc_make.o dist\build\SDL\Raw\Enum_hsc_utils.o -o dist\build\SDL\Raw\Enum_hsc_make.exe --rtlib=compiler-rt -D_UCRT -I4211tooldir/mingw/include -fuse-ld=lld --rtlib=compiler-rt -D_UCRT -L4211tooldir/mingw/lib -L4211tooldir/mingw/x86_64-w64-mingw32/lib -LC:\ghcup\msys64\mingw64\lib -LC:/ghcup/msys64/mingw64/bin/../lib -lSDL2 -lmingw32 -lSDL2main -lSDL2 -mwindows -LC:\cabal\store\ghc-9.4.4\linear-1.22-4f4e696b8a6eb32d2eb8f0032df79f4711e39b6e\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\random-1.2.1.1-86e201420fd0a043a0a7fa8738734800820637c9\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\splitmix-0.1.0.4-ae649aa4d032d2daded286285224149659ab3844\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\lens-5.2-c9eea651389dcd3626576646299d7a19c5dc14e5\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\strict-0.4.0.1-cc75aaa21032d07dd9794fcd053e0264ab79cf54\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\these-1.1.1.1-e305e3d6d824fcc937d1a91f58ff4d0f7de949e2\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\reflection-2.1.6-13a1b7152c614cc960d81007ffe442e31dd4d2d6\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\parallel-3.2.2.0-c541bab4dfda375c74a9543941c4cd84d5685c63\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\kan-extensions-5.2.5-442cc6ef7b5b4d7cd00efb94066fe9d2f81d140e\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\invariant-0.6-87d453ed3dc5bf306de17c08cc3e44dd03b0babf\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\indexed-trave_-0.1.1.1-6a7f2a82b55cecb0a41eb8688355ed9f18a4b949\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\vector-0.12.3.1-4a56c6ea2fef62e2b065fed5cf6b36bfcbeb8af9\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\call-stack-0.4.0-94500f79812e9260de929cc2be03953d2758b0b4\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\bytes-0.17.2-9b153fda7f4614e46f23b8beff510269aa861e06\lib -LC:\ghcup\msys64\mingw64\lib -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\time-1.12.2 -LC:\cabal\store\ghc-9.4.4\scientific-0.3.7.0-a84a50b76b8340d4bf646ac80e5438b5505478a5\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\primitive-0.7.4.0-6b8d0cd8442287a2117e65ee3a39e82e6c8f7862\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\integer-logar_-1.0.3.1-c8bc54b20a7cfd18b306473ad4b23dfeed421a69\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\cereal-0.5.8.3-4de68f5f8642bd9c949b50f3a4c871580fbf1b25\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\binary-orphans-1.0.3-f29794beeba070d76bb98d488ddac60d139e31ba\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\assoc-1.0.2-0b9bf0379c6e74781a3df49cad294a6c3f0489b1\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\adjunctions-4.4.2-bc2828c1f0d86af14f6ed90e27b92e894e212a64\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\void-0.7.3-19a95bcbb4e1cb953e43ba50f34db21c6c4be966\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\semigroups-0.20-0467d5735f6d045e753155ba535f16d7cf8c8116\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\free-5.1.10-3564f9ce9fb60f1e197ef62b7581c578a5ec5b6f\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\transformers--0.4.6-4ecb85ac7dcab69add7271a76e3e3a489155a309\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\semigroupoids-5.3.7-d9cbefe2ee6b05a77af20f92e8d418ad902c9256\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\unordered-con-0.2.19.1-188e24712a4ca736b3e589ff6a0f1049a4b9e25b\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\hashable-1.4.2.0-d14eba0cd6b93846f3eaa755aa646ba2d81463a4\lib -LC:\ghcup\msys64\mingw64\lib -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\text-2.0.1 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\binary-0.8.9.1 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\bytestring-0.11.3.1 -LC:\cabal\store\ghc-9.4.4\profunctors-5.6.2-18313cec8c48c181044bb96fb13183bd6d74b85c\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\bifunctors-5.5.14-571bb92a5fe3e5d895d4b369047d945aaf988497\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\th-abstraction-0.4.5.0-c27a7d2ccb72839f827bbd6b933aec563af04e83\lib -LC:\ghcup\msys64\mingw64\lib -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\exceptions-0.10.5 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\mtl-2.2.2 -LC:\cabal\store\ghc-9.4.4\contravariant-1.5.5-bf9a55568329c17d4eae11000f27564a97a41bc4\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\comonad-5.00.7.2-6c9e896e0fd8f3122d1d4eb25185c37ca1f48c8d\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\indexed-trave_-0.1.2-b74c69d4fc67559efc938eb652aca071ae7729da\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\distributive-0.6.2.1-fc0d2ef0a6b73218acb7df4f3700ffa5af288050\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\tagged-0.8.6.1-03c4124541fdb2450e4dd675c85815f1dae6649b\lib -LC:\ghcup\msys64\mingw64\lib -LC:\cabal\store\ghc-9.4.4\base-orphans-0.8.7-77cbb97dd69e7b0d11fc2d8f2369d8f0c87b75e5\lib -LC:\ghcup\msys64\mingw64\lib -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\containers-0.6.6 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\Win32-2.12.0.1 -luser32 -lgdi32 -lwinmm -ladvapi32 -lshell32 -lshfolder -lshlwapi -lmsimg32 -limm32 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\filepath-1.4.2.2 -LC:\cabal\store\ghc-9.4.4\StateVar-1.2.2-91cf253a19ee3cc83cfc248012c795eb1df27fbf\lib -LC:\ghcup\msys64\mingw64\lib -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\transformers-0.5.6.2 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\stm-2.5.1.0 -LC:\cabal\store\ghc-9.4.4\OneTuple-0.3.1-fac8b44d2fb32535bc1c7e50edd127285b8f0134\lib -LC:\ghcup\msys64\mingw64\lib -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\template-haskell-2.19.0.0 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\pretty-1.1.3.6 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\deepseq-1.4.8.0 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\array-0.5.4.0 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\ghc-boot-th-9.4.4 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\base-4.17.0.0 -lwsock32 -luser32 -lshell32 -lmingw32 -lkernel32 -ladvapi32 -lmingwex -lws2_32 -lshlwapi -lole32 -lrpcrt4 -lntdll -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\ghc-bignum-1.3 -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\ghc-prim-0.9.0 -luser32 -lmingw32 -lmingwex -lucrt -LC:\ghcup\ghc\9.4.4\lib\x86_64-windows-ghc-9.4.4\rts-1.0.2 -lm -lwsock32 -lgdi32 -lwinmm -ldbghelp -lpsapi -lpthread -lmingwex
error: ld.lld: error: undefined symbol: __stack_chk_fail

referenced by libSDL2main.a(SDL_windows_main.c.obj):(.text)

ld.lld: error: undefined symbol: __stack_chk_guard

referenced by libSDL2main.a(SDL_windows_main.c.obj):(.refptr.__stack_chk_guard)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error: cabal-3.8.1.0.exe: Failed to build sdl2-2.5.4.0 (which is required by
exe:testmonomer from testmonomer-0.1.0.0). See the build log above for
details.

@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

Thanks for the fast response!

@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

Mainly a cabal issue, I guess. :(

Wondering if Cabal can be induced to do all of this automatically

@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

Tried executing a toy program via stack. SDL2 compilation blows up.

@fjvallarino
Copy link
Owner

Based on what I see from this issue on Haskell's SDL2 repository, it seems to be an issue with the SDL2 provided by MinGW.

I wonder if installing an older version of SDL2 would solve your issue. At some point in the past, I investigated how it could be done, but I'm not sure this still works. You can check it here. For reference, I paste below the original comment:

It seems you can manually download a specific version of a library from here and install it with:

stack exec -- pacman -U mingw-w64-x86_64-SDL2-2.0.14-2-any.pkg.tar.zst

Removing the current version can be done with:

stack exec -- pacman -R mingw-w64-x86_64-SDL2

@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

Are there any goals toward better cabal support? As in, can cabal force installation within mingw of the required packages?

You know, Cabal won the Cabal vs Stack war, although it's quite obvious where stack is immensely useful.

@fjvallarino
Copy link
Owner

@liamzee I'm not planning on giving priority to Cabal over Stack for the moment. While Stack is not receiving much development at the time, its builds work fine everywhere thanks to Stackage releases. There is a proposal to easily use Stackage LTS release from Cabal, but I think there are a couple of things pending.

I'm not planning on automating the installation of dependencies, mainly because it would become a maintenance nightmare for me.

@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

Installed now. Thank you so much!

@liamzee
Copy link
Author

liamzee commented Feb 16, 2023

Still bugged on windows. I used mingw-w64-x86_64-SDL2-2.0.22-2-any.pkg.tar.zst, which was the last working version. What I get is that all the text is missing, and buttons don't seem to be there. I'll keep on messing around.

@liamzee
Copy link
Author

liamzee commented Feb 21, 2023

https://gitlab.haskell.org/ghc/ghc/-/issues/22999

Issue created by Tamar Christina. I'm switching to Linux to attempt to get Monomer working, but hopefully build issues will be handled by GHC in future releases.

@fjvallarino
Copy link
Owner

@liamzee thanks for letting me know! I'll keep the issue open.


Meanwhile: this is far from ideal, and if you're currently using new GHC features it is not even an option, but have you tried using GHC 8.10.7? To test this, you can modify stack.yaml and set the resolver to (if you're using Cabal I guess you need to set the default compiler to 8.10.7 using ghcup):

resolver: lts-18.27

I did test this version on Windows in the past, and the examples worked without issues. If you're not using new GHC features, it can be an option until the MinGW situation is fixed.

@fjvallarino fjvallarino added build issues Build is failing platform issue Issue happening on specific platform and removed question Further information is requested labels Feb 21, 2023
@liamzee
Copy link
Author

liamzee commented Feb 21, 2023

Okay, been messing around on Windows and Debian.

It looks like the issue is, if you use cabal install to dump it into cabal/bin, or stack install, you end up with monomer programs that don't have their assets affixed.

So it's sort of a configuration problem, but ideally, monomer should read defaults from somewhere.

===

My interest is in getting Haskell to become accessible to everyone, and I think monomer is a great library / project. Thank you so much for your work on Monomer.

@fjvallarino
Copy link
Owner

@liamzee I'm not sure I understand the issue you mention in the last comment. The library loads assets using the directory where the application is run as its base path, which is a common behavior.

Regarding the original issue, it's something outside the control of the library and should probably be closed.

@liamzee
Copy link
Author

liamzee commented May 20, 2023

fjvallarino: apparently data-files in Cabal is rarely used, and I'm still waiting to get help to get data-files to work. Not sure about the Stack equivalent; trying to config monomer there blew my ghci config.

Re my assorted whining, thanks for your patience so far, but I'm going through the library's own source code now and will come back only when I have some pull requests available. You're already using wreq and by extension cryptonite, shouldn't be too hard for me to finagle some settings that allow font downloads in the event that font assets are missing.

@liamzee liamzee closed this as completed May 20, 2023
@liamzee
Copy link
Author

liamzee commented Aug 17, 2023

Just opening an update via Ben Gamari on what's going on with the stack protector issue:

9.10.1? :)

https://gitlab.haskell.org/ghc/ghc/-/issues/22999#note_520844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issues Build is failing platform issue Issue happening on specific platform
Projects
None yet
Development

No branches or pull requests

2 participants