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

Install on Windows does not work #26

Closed
theoremprover opened this issue Oct 3, 2021 · 10 comments
Closed

Install on Windows does not work #26

theoremprover opened this issue Oct 3, 2021 · 10 comments
Labels
build issues Build is failing platform issue Issue happening on specific platform

Comments

@theoremprover
Copy link

theoremprover commented Oct 3, 2021

In the installation on Windows procedure (as descibed in 00-setup.md),

stack exec -- pacman -S mingw-w64-x86_64-pkg-config

will report the following errors:

error: mingw32: key "FA11531AA0AA7F57" is unknown
error: key "FA11531AA0AA7F57" could not be looked up remotely
error: mingw64: key "FA11531AA0AA7F57" is unknown
error: key "FA11531AA0AA7F57" could not be looked up remotely
error: msys: key "FA11531AA0AA7F57" is unknown
error: key "FA11531AA0AA7F57" could not be looked up remotely
error: database 'mingw32' is not valid (invalid or corrupted database (PGP signature))
error: database 'mingw64' is not valid (invalid or corrupted database (PGP signature))
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

I have no idea what is going on, even after googling a lot.
"pacman -Syu" fails with similar errors.
Is it possible to update 00-setup.md to describe what has to be done?

Thanks
Robert

@fjvallarino
Copy link
Owner

fjvallarino commented Oct 4, 2021

I had that issue, and it was caused by an old MinGW version installed by Stack.

At some point, the MinGW project changed their certificates; supposedly, it is possible to upgrade them manually, but it didn't work for me (and it was a pretty complex procedure).

Stack installs files in two places:

  • C:\sr
  • %LOCALAPPDATA%\Programs\stack

The second location is the one that contains MinGW. If I recall correctly, removing %LOCALAPPDATA%\Programs\stack and running stack setup again was enough to get a working environment. I may have had to remove C:\sr too.

Note: In case you remove C:\sr, you will need to install Stack again.

@fjvallarino fjvallarino added build issues Build is failing platform issue Issue happening on specific platform labels Oct 4, 2021
@theoremprover
Copy link
Author

theoremprover commented Oct 5, 2021

Worked, I had to delete %LOCALAPPDATA%\Programs\stack only,
then "stack setup" and all the "stack exec -- pacman" lines given in the setup tutorial.
Thanks fjvallarino! :-)
P.S.: Maybe one should mention that in the setup tutorial, probably more people falling for that... :-/

@fjvallarino
Copy link
Owner

Nice!

I'll add a note to the Setup page. As you mention, it may be helpful to other people who face the same issue. Thanks!

@Clindbergh
Copy link
Contributor

I'm facing the same issue. Unfortunately deleting both directories and reinstalling stack did not help. I wonder whether a system installed msys2 or git bash may interfere, though it seems unlikely from what I read. Do you have any recommendation?

@fjvallarino
Copy link
Owner

If you have other msys2 installs, make sure they are not visible in PATH (the one installed by Stack should be visible). Just to be sure, when compiling on Windows:

  • I use the standard Command Line application (not PowerShell nor Cygwin).
  • I do not run git bash or anything similar to ensure that I rely on things available on a default Windows install.

Have you tried running stack setup on Monomer's/your application directory? Maybe stack purge too, so it rebuilds everything.

What is the exact error you're getting?

@Clindbergh
Copy link
Contributor

Thank you for your quick reply!

I removed msys2 installed by git bash from the path. It now points to the same version as in the current stack github repository:

where msys2
C:\Users\Me\AppData\Local\Programs\stack\x86_64-windows\msys2-20210604\msys2.exe

I also made sure I was not using git bash anymore and worked on cmd instead. Although the stack guide mentions, that git bash could be used.

I deleted both mentioned folders, reinstalled stack but I am still facing the same error:

stack exec -- pacman -S mingw-w64-x86_64-pkg-config
resolving dependencies...
looking for conflicting packages...

Packages (2) mingw-w64-x86_64-libwinpthread-git-9.0.0.6215.788f57701-1  mingw-w64-x86_64-pkg-config-0.29.2-3

Total Download Size:   0.28 MiB
Total Installed Size:  1.39 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 mingw-w64-x86_64-libwinpthread-git-9.0.0.6215.788f57701-1-any                                    28.9 KiB  1205 KiB/s 00:00 [##########################################################################] 100%
 mingw-w64-x86_64-pkg-config-0.29.2-3-any                                                        262.8 KiB  6.42 MiB/s 00:00 [##########################################################################] 100%
(2/2) checking keys in keyring                                                                                               [##########################################################################] 100%
(2/2) checking package integrity                                                                                             [##########################################################################] 100%
error: mingw-w64-x86_64-pkg-config: signature from "David Macek <[email protected]>" is unknown trust
:: File /var/cache/pacman/pkg/mingw-w64-x86_64-pkg-config-0.29.2-3-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] Y
error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occurred, no packages were upgraded.

I am not sure where to look to resolve this error. Any ideas?

stack setup works fine, stack purgethrows exception because of permission issues on sqlite3 files in .stack-work. I can delete the folder manually though (I assume it is sufficient).

(I also tried to run stack build which actually works fine until nanovg. I had to delete the cabal.exe file along the way because it was empty)

Btw: Is there an easier (as well as reliable and automated) way to install the dependencies when distributing an application?

@fjvallarino
Copy link
Owner

It surprises me a bit that your path is C:\Users\Me\AppData\Local\Programs\stack\x86_64-windows\msys2-20210604\msys2.exe. That means you are using version 20210604, but msys's installer shows 20220128 as their latest. Of course, this may be caused by Stack not installing the latest msys, but it's worth checking. What do you get when running this?:

stack exec -- where pacman

I still think the problem is an old version of msys hanging around somewhere but, just in case, there are a few issues on msys's repository that mentions potential solutions. For instance, this issue's comment suggest running:

stack exec -- pacman -S msys2-keyring
stack exec -- pacman -Syu

Or this other comment in a separate issue, suggesting:

stack exec -- pacman-key --keyserver keyserver.ubuntu.com --refresh-keys
stack exec -- pacman -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz

I remember trying similar solutions in the past (a couple of years ago), and the simplest/most reliable option was getting rid of all existing msys instances. Maybe checking the result of stack exec -- where pacman-key would be a good idea too.


When it comes to distributing your application, you should be fine by copying the .dll files along with the executable (users of your application should not need msys installed on their machines). The executable file is stored in a path similar to: /Users/.../dev/project-name/.stack-work/install/x86_64-osx/some-hash/8.10.7/bin. You can retrieve the .dll files from msys' directory. I won't have access to my Windows box for a couple more weeks, but I'll review the process as soon as possible.

@Clindbergh
Copy link
Contributor

🥳 Compiling now worked and I can run all the examples 😃. Thanks for the support.


A few comments on your suggestion. Maybe helpful for others or it may point to a misconfiguration in my system.

pacman is installed in the stack folder too:

stack exec -- where pacman
Writing implicit global project config file to: C:\sr\global-project\stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-18.26
C:\Users\Me\AppData\Local\Programs\stack\x86_64-windows\msys2-20210604\usr\bin\pacman.exe

There is indeed another msys2 instance installed (probably for git bash). It's located in C:\msys64 and it uses a different pacman location. I have made sure, that this msys2 instance is not exposed to the path.

The first two commands you suggested worked resolved the problem of installing the dependencies. I thought I had tried it before and I think I tried it twice too this time. The second time I added --verbose and I may have deleted the %LOCALAPPDATA%\Programs\stack directory in between. After that stack build worked.

Oddly, the second suggestion with pacman-key did not work:

stack exec -- pacman-key
Executable named pacman-key not found on path: [ <Paths ommitted> ]

...even though...

stack exec -- where pacman-key
C:\Users\Me\AppData\Local\Programs\stack\x86_64-windows\msys2-20210604\usr\bin\pacman-key

@fjvallarino
Copy link
Owner

That's good to hear! To confirm: are these the commands that solved the issue?

stack exec -- pacman -S msys2-keyring
stack exec -- pacman -Syu

I'll add them to the documentation if that's the case (mentioning the msys issue where they come from)

@Clindbergh
Copy link
Contributor

Sorry, I have been away a few days and haven't worked on it.

Yes, I believe these were the essential commands that solved the issue. However, I'm not sure if I had to delete the directory again afterwards or even reinstall or run these commands twice to solve the problem. It would probably be a good idea to add these commands to the documentation. Thanks!

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

3 participants