Issues with Haskell environment on Windows platform

leksah

This is actually a mail meant for the Haskell mailing list, but unfortunately joining those lists these days seems like a very complicated manner, since I’m still waiting for approval to join them (they probably don’t like my name). So I’ll blurt things here, it will describe the trials and tribulations of a beginner with Haskell on Windows, and hopefully someone will point this rant in the right direction and at the right people (which I can’t unless they stop disliking my name).

I am getting started with Haskell, and I’m trying to install on my day to day machine, which is a Windows 7 desktop. So I made the first steps by installing the Haskell Platform for Windows.

Then I looked for an IDE for Haskell. Although I am a fan of CLI, I find Windows cmd.exe window horrid and counter productive. So I hear about leksah, and that the preferred way to install it (and, it seems, to install tons of other stuff) is to use cabal.

So I happily typed cabal install leksah, only to be prompted with the message: “no such package”. Obviously, this is a bug, since cabal could’ve seen easily that it has no data in the database, and perform ‘update’ for me, but let’s let things slide for a short while. So I run cabal update and I try again.

Then I get some random error (I am not used to reading which is an error message and which is not) regarding lack of some tools that I don’t have. And while some of you would point me, diligently, towards the installation guide, please bear in mind that I am a beginner, therefore prone to not understanding documentation very well. And since I reuse knowledge from the other tools I use, I think that obviously, any package manager would automatically resolve dependencies for the missing packages, right? Wrong. There are no dependencies for the tools required in cabal packages, like they float over the water, and expect a working environment there. And I obviously have one, since I am telling you about my first (ok, ok, second) error I encounter.

I let things slide a bit more and perform cabal install gtk2hs-buildtools which absolutely makes no sense whatsoever. But I do it, and they I run cabal install leksah. Success?

No…

No success whatsoever. It complains that glib lacks pkg-config, a tool that I know and I understand what could be used for; but there’s no way I could go on from here. pkg-config? Why?

And stackoverflow considers I’m an idiot, and tells me that I should perform some voodoo tricks that make no sense on my machine. And I’m therefore very very upset.

Surely, I could install leksah from the .exe file that I find on the website. If I choose the right one, of course, because there’s 4 (four) of them. And then, you have all these packages that need to be installed using cabal. And if you manage to find the right package, install it, the first image of leksah is: “where are your packages?”

And the answer is: “I have no friggin’ clue. There was nothing in this that asked me for package installation”.

You can see now how voodoo everything feels for a zero-day Haskell user on Windows. I have no idea why pkg-config is missing, but more importantly, I should NOT care. I have no idea why I need
gtk2hs-buildtools, and again, I should NOT care, since that’s what we use cabal for, right? And it should be obvious for anyone that installs Haskell Platform and all the things from scratch, because there’s no way you can avoid this. Not on my machines, at least.

Remember, this might be very well the first contact that the next Windows programmer has with Haskell. I guess it’s an important thing, and please, if you can, while proving that I’m an idiot, help me understand what have I done wrong, and why don’t things work.

PS: Initial post title was “Haskell Platform for Windows is crippled”, however, it was pointed out that everything works just fine, except for the IDE installation, which is correct. I changed the title (I didn’t modify the slug, tho’), unfortunately, even this new title is slightly incorrect.

Comments

Issues with Haskell environment on Windows platform — 34 Comments

  1. I seen that, but I’m pretty sure that at least the issues I had can be fixed.

    I am generally disappointed with the tricks one has to perform in order to have UNIX software on Windows, cygwin being by far the best option (but the slowest to have updates). In this case, however, I think that the fixes should not be very tough to perform…

    I will have a look at your suggestions once I get home to my ‘working’ environment. Many thanks!

  2. Regarding a GUI – you got try to get a beta account for Haskell Center on FP-Complete (https://www.fpcomplete.com/business/haskell-center) – it’s pretty impressing.

    Aside from this there is Eclipse and a Haskell-Plugin for it – but I do not really like this eiter.

    Indeed I do my little Haskell projects with Sublime Text (+ Sublime Haskell) and I’m happy with it so far.

    Another tip is do not do “cabal install” to much – sooner or later you will be in cabal-hell-land – instead get yourself cabal-dev (yeah with cabal install :D) and use this whenever possible.

    Finally: the biggest issue on windows is IMHO the bad 3rd party support (for example installing wxWidgets or any other toolkit) and the lack of a bash so some packages will fail to compile/install – you can somewhat get around this by installing MinGW and mSys but in the end you should consider installing yourself a little Linux (for example Ubunut) VM on windows (virtualbox is great for this) – you will spare you a lot of pain and you can even backup the VM and restore it if you manage to mess up your packages :P

  3. It’s strange to have packages failing to install and if the packages cannot be maintained in a platform-free manner, what’s the purpose of cabal? :D

    Of course, I can try the VM thing but my laptop is not powerful enough to run that, and I would like to work with my laptop; on the desktop I already used this solution,

  4. I tried this as well, and it worked. But I think that lack of homogeneity cripples the experience of the developers trying to test the waters. Or, maybe, leksah should be included in the Platform installer, why not? :)

  5. Problem is not in the package per se but in it’s OS dependencies. GTK2hs, DevIL, etc all depend on some C or other language libraries to be installed on the system.

  6. gtk2hs can easily depend on a gcc package, or on library X or Y. I hope. Haskell Platform already delivers a compiler, it could deliver those tools as well, and cabal should use that. Dependencies can be improved in my opinion, and depending on a funky order or content in %PATH% or anything like it is not really the way to go.

  7. Including these as well will result in an overbloated install size with many components you won’t necessarily use (for example the DevIL above :P). Also, when one of them changes significantly a new platform would have to be released just to include the newer binary/OS library. Which is not ok.

    Not to mention that Java and any other big project still has some needs of modifying the PATH or other system variables.

  8. I think I mentioned in some occasions that Java has a development environment borrowed straight from the cave of Homo Neanderthalensis.

    If those components are not needed, then they could be packaged and delivered when needed. Or the packages that don’t install should just be removed from the cache of cabal; and not deliver them under Windows. But that would be quite a big downside to using it, right?

  9. Let’s take it from another point of view: you install Windows on your system. Because you have some specific hardware components you need to also install drivers for these. Don’t you need to install them by hand? Are all of the drivers in the world on that Windows install medium?

    On Linux is easier to install everything just because there is a common underlying platform for installing things: (apt-dep and the likes), ./configure, make, make install.

  10. It’s not that easy – take packages that depends on OpenGL for example – you need .dlls for your system but those might not be open source or of a different kind of license or whatever.

    BTW: Ubuntu with a lightweight GUI (xfce for example) runs just fine in a VM (does not really need more than one CPU and around 1GB ram …)

    After all, the package-hell thing sounds strange first – but if you really try to understand the problem you will find that it’s not likely to be solvable (the open-source character of Haskell just makes this more ugly because packages seems to change more often and if they do break your code rather frequently)

    What I really want is something like the Stackage thing (https://www.fpcomplete.com/blog/2013/07/ide-stackage) – *STABLE* / best-practice libraries for your most common real-world programming stuff in a nice Haskell-Platform bundle – so I only have to install other packages if I wand to “experiment” or something.

    This is one of the biggest show-stoppers for me – finding the right package to do mondane things like creating bitmaps, network-communication, XML and JASON parsing or even just a simple GUI or Web-Dev (yeah Snap and Yesod seems to be getting there).

    Why are languagues like JAVA, Python and C# so dominant if not because they take their users by the hand and give them one simple solution to practical everything …

    I like the ebony-towery-things in Haskell as well … but to explain CT to my fellow worker so that he can follow my simple XML-parser? …. NOT REALLY

  11. If you want help on this kind of things, avoid negative words like “crippled”. They don’t give a positive impression about you and does not actually help you getting help.

    Also, there isn’t a single error message in this blog post, just random rambling from which it is impossible to deduce what is/was the problem.

    You if have a problem installing Leksah, don’t blame the Haskell platform. I presume you had problems installing GTK+ or other dependencies which is outside of the scope that cabal does.

    Cabal is a tool for installing Haskell libraries, it does not install system libraries that the Haskell libs depends on. Libraries like GTK+, LLVM or OpenGL must be installed before you can install the Haskell binding/wrapper for it.

  12. @Mihai: Drivers are quite easy to install lately in Windows (Windows Update usually has them) The same would go for Linux, and unless Linux has them in the kernel, you’d have to find modules for your hardware. Either way, Haskell Platform is (or should be) a platform. Which is bigger than an SDK or anything like it. :) It’s .NET grade thing. :)
    In Linux things are hackier, in fact. Sure, the things are already there, but that’s because the platform is already crammed with useless stuff.

    @Carsten König: Yes, yes, ebony-towery things are cool, unfortunately they are so 1995. I guess I’m just tired of doing all the small details in Linux distros across the years, that’s why I fell back in Windows – less headaches, better battery life.

  13. … TBH: never had a PATH problem with .NET – but there can be version problems with libraries/dlls/assemblies (different used versions for FSharp.Core comes to mind), BUT: those are very rare and can be solved by changing project-settings/configs

  14. Installed how? That’s my issue with the whole ‘platform’ thing. And it is crippled because I cannot use the very ‘recommended’ way to install some components. I would say the same about RPM if I wasn’t able to install haskell under Linux using RPM because I should’ve had some magic deps already satisfied.

    You don’t need to see the error message itself, but I can paste it, if that’s the problem. The problem is missing pkg-config, and glib fails to install because of that. But anyone with a clean Windows installation can see that error message.

    I’m not here to impress, I’m here to point out some (valid, I would say) points, which I describe in enough detail. I invite anyone to go through the same steps as I have, to experience this on their own. I explained what the error is.

    I would like to have a chat with the packager; since glib requires pkg-config, shouldn’t there be a dependency defined? Should that be resolved automatically? My suggestion is: yes, it should. I would even help with that, but I have still problems understanding how the Haskell Platform works.

  15. Understand that pkg-config is not Haskell-related. You need to install it by hand before, there are several places where they tell you about that.

  16. last time I installed Haskell Platform on a clean Window7 I had to install nothing before … either this is really a bug or there was something wrong with Dorins Windows-Installation

  17. Ages ago I had to install the same GTK app on two Windows boxes with similar configuration. One of them worked like a breeze, the other required installing GTK and several other things by hand.

    Later, while being puzzled by this, I found out that the first box had Pidgin and GIMP previously installed and their installers took care of GTK and libs.

  18. Am I understanding your problem correctly? You are trying to install Haskell package for Glib (and/or GTK), which requires pkg-config and thus fails? pkg-config is not a Haskell software, it is a unix tool for configuring builds. It can not and should not be installed by Cabal.

    In order to do what you want (install Leksah, which requires GTK and Glib), you will need to install the system prerequisites to make it happen. That may involve reading instructions. Don’t expect the Haskell tools to configure your entire system, there are different tools for that.

    You are expecting the Haskell platform to be something that it isn’t (by design) and then publicly calling it “crippled”, which is almost offensive.

    You are expected to be able to read the instructions on how to install packages and their prerequisites. You are confusing cabal (a Haskell development tool) with a complete operating system package manager like apt.

    Whatever the point of this blog post is (your frustration, I presume) it is not helping anyone solve any problems. You should have at least included the error messages and detailed account on what you did and what you were trying to do.

    Open source is a team effort, not a free service.

    You *should* have a chat with the package maintainers if you feel like it (the name and e-mail should be right there in the package info), but be polite and ask how you can help. Don’t be an ass who wants free support.

  19. My goal is not having glib installed with cabal, but it is to have leksah installed with cabal.

    About being an ass who wants free support, I can tell you I am not, and that my mis-reading of the documentation is something that will happen for most of the users, however, I could’ve said “f*** it” and ignore anything that all the good people that will encounter the same problem as me be left without an answer. After I found out what the problem is I’ll search again for fixes for the problem, or dedicate a blog post describing the solution. Because I am pretty sure this doesn’t happen to me alone, unless the evil duck is INDEED watching my every move from the sky.

    I don’t confuse cabal with a complete OS package manager like apt; I expect it at least to give me some hints of what it needs to complete the installation. Yes, it needs pkg-config, and knowing what pkg-config is I know that it doesn’t need some executable thrown somewhere in the PATH, but it’s a more complex setup needed.

    One more note, on this blog I’m the only one allowed to be rude.

  20. > This is actually a mail meant for the Haskell mailing list, but unfortunately joining those lists these days seems like a very complicated manner, since I’m still waiting for approval to join them (they probably don’t like my name).

    Registration was automatic last time I remember, did you actually try to mail a message to the ML?

  21. Using Haskell on Windows is a very bad idea, even if you had no problems with installation. For one, there’s no I/O manager for Windows, meaning if you wanted to test any of the high-performance Haskell web-servers you’re in for a huge disappointment.

  22. I just started looking into Haskell this past weekend, and I’ve had basically the same experience. So far, the best experience I think currently for Windows, is to install Haskell Platform and use Sublime Text with Sublime Haskell.

    I also installed Haskell Platform for OSX, and didn’t have too much trouble getting Leksah installed; though Leksah is still very much in development. OSX has problems with Haskell on its own, for example: I tried getting a basic GLFW app written, and had trouble with linking to the GLFW library (yes I used cabal to install GLFW-b) – on Windows, the app worked fine.

    Seems Haskell still has some way to go, but it has been taking baby steps toward SPJ’s “nirvana”.

  23. The problem is you are attempting to install a full application, i.e. Leksah using a tool used to deliver Haskell libraries (for development). Cabal is not meant to be a Haskell application installation tool. It is merely a method to deliver Haskell libraries for development purposes. This is why the exe installer is provided for Leksah.

    On that front, since Haskell libraries are delivered in source form (not binary) it vastly reduces the complexity in supporting multiple platforms. i.e. it does not need to store each platform’s binaries pre-compiled. Instead the tool downloads the library, compiles it for your machine, and installs it to a global package directory (or a custom one if you so choose).

    While GTK could be distributed with the leksah package, this would cause very large package bloat as every version of GTK across all platforms (Mac OS, Windows, Linux, x86/x64 across all) would need to be delivered resulting in a very large package size. Not only that, but maintenance of this package database would grow in scope to that of say APT or any linux package manager.

    While you are right that the error message could be a little more friendly, this is more the fault of the package creator (leksah), than cabal itself. When writing a package it is possible to put in checks and friendly error messages if dependencies are missing.

  24. I wouldn’t blame the leksah author. In this case, the glib package is the one causing mayhem, and I don’t understand why that happens.

  25. Hmmm, de acord, atunci nu mi-era clară separația. Problema e că Leksah o fi un 3rd party, dar e foarte probabil ca un începător în Haskell să dorească să îl folosească. Pe Linux merge. Pe Windows, însă, nu e suficient de matură. Cum spunea mai sus cineva, lipsesc niște componente importante.