haskell-gi / haskell-gi

Generate Haskell bindings for GObject-Introspection capable libraries
Other
290 stars 74 forks source link

Is it possible to use your example code on Windows 10? #129

Closed bigos closed 6 years ago

bigos commented 6 years ago

If so can you provide a recipe, a series of steps from installing Haskell to successful running of example program

garetxe commented 6 years ago

Yes, it is possible. I wrote instructions in the wiki: https://github.com/haskell-gi/haskell-gi/wiki/Using-haskell-gi-in-Windows

The instructions are perhaps a little bit schematic, if you think some important details are missing please do not hesitate to add them! (After figuring them out ;) )

bigos commented 6 years ago

Sadly on Windows 10 with a bit schematic instructions, it is very hard to figure out the important details. You should get a reward for suggesting to use a virtual machine for the experiments. With cabal hell I tried to use stack and ran into strange problems.

garetxe commented 6 years ago

Sorry to hear that you ran into problems. I don't use Windows myself, so I am not sure how much I can help with the details, but didn't have too much trouble getting things working when I tried, so I hoped that people more experienced than me would find the instructions easy enough. (By the way, the instructions I followed are those of leksah, perhaps reading those helps too.)

In any case it would be great if you could help filling in any missing details in the wiki, if you think any steps should be written down in more detail. This way we can help other Windows users.

bigos commented 6 years ago

I have lots of scraps of contradicting information. I have no idea which is out of date. The wiki has a link to download a Windows VM. Unless somebody more knowledgeable about Haskell does it successfully in a VM and posts the instructions I am unable to compile even a simple code example.

bigos commented 6 years ago

https://stackoverflow.com/questions/40538626/how-to-build-gi-gtk-package-on-windows-10-with-stack possibly related

aarroyoc commented 6 years ago

@bigos have you successfully run the example code on Windows 10?

bigos commented 6 years ago

No, absolutely not! I have wasted lots of time trying various combinations of installation. At best I get to an error where it says tht a dll library can not be found or i get some exception. We need a step by step description where a noob can follow instructions and install correctly the platform run the code and see the promised results. All over the place there are error messages submitted by people who who got to that stage and gave up. Is it at all possible to do it on windows. Some people claim they did it but their descriptions are so vague that I do not understand them. also there is no record how did they get to that place at which they started applying their instructions. We need instructions from download to run the example with all the steps in between. Otherwise every noob who tried it will be convinced that Haskell is not for the practical stuff. I have successfully compiled movie-monad on Linux. Can we look into the Windos issues and solve it once and for all or declare that at this point in time it is not possible.

bigos commented 6 years ago

cabal install gi-gtk with paths set to poit to Msys2 installed libraries gave me the following:


[91 of 95] Compiling GI.Pango.Objects.Layout ( GI\Pango\Objects\Layout.hs, dist\build\GI\Pango\Objects\Layout.o )
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 8.2.1 for x86_64-unknown-mingw32):
    tcIfaceGlobal (local): not found
  You are in a maze of twisty little passages, all alike.
  While forcing the thunk for TyThing Layout
  which was lazily initialized by initIfaceCheck typecheckLoop,
  I tried to tie the knot, but I couldn't find Layout
  in the current type environment.
  If you are developing GHC, please read Note [Tying the knot]
  and Note [Type-checking inside the knot].
  Consider rebuilding GHC with profiling for a better stack trace.
  Contents of current type environment: []
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler\utils\Outputable.hs:1133:58 in ghc:Outputable
        callStackDoc, called at compiler\utils\Outputable.hs:1137:37 in ghc:Outputable
        pprPanic, called at compiler\iface\TcIface.hs:1696:23 in ghc:TcIface

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
garetxe commented 6 years ago

@bigos That is a bug in GHC, see https://github.com/haskell-gi/haskell-gi/issues/113. Things should work if you use GHC 8.0.2.

garetxe commented 6 years ago

Is it at all possible to do it on windows.

Yes, it is definitely possible. I just tried again on a Windows VM, and I could compile a sample program following the instructions in the wiki. The instructions may not be as detailed as you wish for, and I would be happy to improve them, but I cannot do so unless you give specific details of what fails for you.

In other words: I simply have no idea where you are getting stuck. Did you install chocolatey and msys2? Did you set the paths properly, as explained in the wiki? If you did that, things should work basically as in linux.

bigos commented 6 years ago

I will have another go

bigos commented 6 years ago

One potential problem. How do I run cmd as administrator? At some point the choc command requires administrator.

bigos commented 6 years ago

Missing Instructions

Click on the circle next to windows start button and type cmd. The search result will show Command Prompt icon. Right click on it and select ~Run as administrator~.

bigos commented 6 years ago

haskell-gi.exe has appeared :-), it's looking good

bigos commented 6 years ago

https://gist.github.com/bigos/12a77332c702c1c8be1d464f0fe72698

All credit goes to you garetxe. You are the most helpful Haskell user I have ever met.

bigos commented 6 years ago

This is simplified version https://gist.github.com/bigos/62defeec09a06f18ee38daf644af5340 that shows handling of stack surprises on Windows.

garetxe commented 6 years ago

Awesome, thanks a lot!

I would like to add some of very nice instructions you wrote to the wiki, if that's all right. (Or feel free to write yourself directly there, I will be happy to take a look.)

bigos commented 6 years ago

I think the instructions need tweaking a bit. You probably need to remove Emacs specific stuff and solve the problem of PATH tweaking somewhat differently. I am happy if you just add it yourself. A little comment about my contribution will not hurt, but mainly the credit goes to you. You gave me the idea to use the VM and placed a screenshot showing it's worth not to give up.

garetxe commented 6 years ago

I just edited the instructions in the Wiki, they are hopefully clearer now. Please feel free to add any clarification you feel is necessary!

bigos commented 6 years ago

For your future reference, this is Stack Overflow question on the subject. The answer submitted by Mike Pilgrem shows a different approach. I have not tried it myself, but I think it's worth to note that other people do it somewhat differently.

https://stackoverflow.com/questions/47280515/how-do-i-set-up-gtk-on-windows-for-haskell-development/48043257?noredirect=1#comment83072282_48043257