Remaining bugs in Cabal under Windows

Krasimir Angelov ka2_mail at yahoo.com
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:

Log:
  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"
    #endif

from cvs-ghc at haskell.org 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
Main.main.

     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
Data"

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
conditionally.
I would like to have a collection of functions like:

getCurrentDirectory
getAppUserDataDirectory
getHomeDirectory

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.

Cheers,
  Krasimir


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail


More information about the Libraries mailing list