Remaining bugs in Cabal under Windows

Krasimir Angelov ka2_mail at
Mon Aug 16 14:19:56 EDT 2004

     There still exists some bugs in Cabal when it is
used under Windows.

   - The platform dependent places in the code are
marked with #ifdef mingw32_TARGET_OS but this macro is
never defined ever under Windows. You must add 
-Dmingw32_TARGET_OS to the command line while building
setup.exe and also add -Dmingw32_TARGET_OS to 
options-ghc field in Setup.description.
   - When Cabal is used to build library package then
it fails to find ar.exe in the path. This isn't a
problem when in the build is run from cygwin or mingw
environment but is painful on plain Command prompt.
   - The package uses (getEnv "HOME") to get the path
to home directory. The variable isn't present in plain
Command prompt under Windows.
   - The default installation prefix under Windows is
"C:\Program Files" but it is known that some times GHC
doesn't work very well with paths which have spaces. I
don't know whether this can be fixed or this depends
from gcc and ld

Each of these bugs have many solutions.

   From the message:

  Define <arch>_TARGET_ARCH and <os>_TARGET_OS by
default when CPP'ing.
  This avoids the main reason for needing to #include
config.h into
  Haskell source, so most files that previously just
#include "config.h" can now
    #if __GLASGOW_HASKELL__ < 603
    #include "config.h"

from cvs-ghc at it looks like the first bug
is already solved for GHC but I don't know whether
this will be adopted from other implementations too.
Most of platform dependent code deals with filepaths
and .exe .so/.dll extensions. Similar code already
exists in many other tools in fptools repository.
Maybe it is a time to collect such code in the
standard library.

    The easiest way to fix second bug is to distribute
ar.exe with GHC much like it already comes with gcc
and ld. GHC can automatically invoke ar.exe when the 
--make option is given and the source doesn't provide

     To fix third bug I tried to use 
SHGetFolderPathAndSubDir function to retrieve the
"Application Data" folder for current user. 
This is:

"C:\Documents and Settings\kr_angelov\Application

on my PC. The trouble here is that to do that I need
to add shell32 to extra-libs field in package
description. I don't have a way to preprocess
Setup.description so I can't add shell32
I would like to have a collection of functions like:


in the System.Directory module. This can make some
applications more portable.

    I would like to hear other suggestions to find the
best way to make Cabal working under Windows.


Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!

More information about the Libraries mailing list